cloudmailin
Version:
Official Node.js for the CloudMailin Email API - https://www.cloudmailin.com
38 lines • 1.92 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudMailinError = void 0;
var CloudMailinError = /** @class */ (function (_super) {
__extends(CloudMailinError, _super);
function CloudMailinError(message, baseError) {
var _this = this;
var _a, _b, _c;
var trueMessage = ((_b = (_a = baseError.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || message;
_this = _super.call(this, trueMessage) || this;
_this.details = trueMessage;
_this.status = (_c = baseError.response) === null || _c === void 0 ? void 0 : _c.status;
_this.baseError = baseError;
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(_this, CloudMailinError.prototype);
_this.name = _this.constructor.name;
Error.captureStackTrace(_this, _this.constructor);
return _this;
}
return CloudMailinError;
}(Error));
exports.CloudMailinError = CloudMailinError;
//# sourceMappingURL=errors.js.map