mirror of
https://github.com/vernu/textbee.git
synced 2026-02-20 07:34:00 -05:00
fix(api): return error message if sms is not sent due to fcm failure
This commit is contained in:
@@ -185,9 +185,20 @@ export class GatewayService {
|
||||
|
||||
console.log(response)
|
||||
|
||||
if (response.successCount === 0) {
|
||||
throw new HttpException(
|
||||
{
|
||||
success: false,
|
||||
error: 'Failed to send SMS',
|
||||
additionalInfo: response,
|
||||
},
|
||||
HttpStatus.BAD_REQUEST,
|
||||
)
|
||||
}
|
||||
|
||||
this.deviceModel
|
||||
.findByIdAndUpdate(deviceId, {
|
||||
$inc: { sentSMSCount: recipients.length },
|
||||
$inc: { sentSMSCount: response.successCount },
|
||||
})
|
||||
.exec()
|
||||
.catch((e) => {
|
||||
|
||||
Reference in New Issue
Block a user