node-easysms
Version:
EasySMS is an SMS sender for Node.js
46 lines (45 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoGatewayAvailableException = void 0;
class NoGatewayAvailableException {
constructor(results) {
this.results = [];
this.exceptions = {};
this.message = 'All the gateways have failed. You can get error details by `exception.getExceptions()`';
this.results = results;
this.exceptions = {};
for (let result of results) {
this.exceptions[result.gateway] = result.exception;
}
}
/**
* 获取发送结果
* @returns
*/
getResults() {
return this.results;
}
/**
* 获取某个网关的异常信息
* @returns
*/
getException(gateway) {
var _a;
return (_a = this.exceptions[gateway]) !== null && _a !== void 0 ? _a : null;
}
/**
* 获取所有网关的异常信息
* @returns
*/
getExceptions() {
return this.exceptions;
}
/**
* 获取最后一个网关的异常信息
* @returns
*/
getLastException() {
return this.exceptions[this.results[this.results.length - 1].gateway];
}
}
exports.NoGatewayAvailableException = NoGatewayAvailableException;