Updated octopush error handling to accept 000

The legacy octopush API includes an error code with all responses. A
code other than 000 is an error.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson 2022-10-01 19:48:00 +01:00
parent 63e408f4f2
commit 97de3959cd
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

View File

@ -54,7 +54,9 @@ class Octopush extends NotificationProvider {
// response data
let response = await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config);
if ("error_code" in response.data) {
this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`);
if (response.data.error_code !== "000") {
this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`);
}
}
} else {
throw new Error("Unknown Octopush version!");