sendingnetwork-bot-sdk
Version:
TypeScript/JavaScript SDK for SDN bots
30 lines • 790 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SDNError = void 0;
/**
* Represents an HTTP error from the SDN server.
* @category Error handling
*/
class SDNError extends Error {
/**
* Creates a new SDN Error
* @param body The error body.
* @param statusCode The HTTP status code.
*/
constructor(body, statusCode) {
super();
this.body = body;
this.statusCode = statusCode;
this.errcode = body.errcode;
this.error = body.error;
this.retryAfterMs = body.retry_after_ms;
}
/**
* Developer-friendly error message.
*/
get message() {
return `${this.errcode}: ${this.error}`;
}
}
exports.SDNError = SDNError;
//# sourceMappingURL=SDNError.js.map