@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
51 lines (50 loc) • 2.27 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.BitmovinError = void 0;
var models_1 = require("../models");
var Mapper_1 = require("./Mapper");
var BitmovinError = /** @class */ (function (_super) {
__extends(BitmovinError, _super);
function BitmovinError(message, httpStatusCode, shortMessage, developerMessage, requestId, errorCode, details, links) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
_this.name = 'BitmovinError';
_this.shortMessage = shortMessage;
_this.httpStatusCode = httpStatusCode;
_this.developerMessage = developerMessage;
_this.requestId = requestId;
_this.errorCode = errorCode;
_this.details = (0, Mapper_1.mapArray)(details, models_1.Message);
_this.links = (0, Mapper_1.mapArray)(links, models_1.Link);
// Maintain stack trace if possible
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(_this, BitmovinError);
}
// Fix prototype chain if possible
if (typeof Object.setPrototypeOf === 'function') {
Object.setPrototypeOf(_this, _newTarget.prototype);
return _this;
}
// Fallback to fix prototype chain if possible
_this.__proto__ = _newTarget.prototype;
return _this;
}
return BitmovinError;
}(Error));
exports.BitmovinError = BitmovinError;
exports.default = BitmovinError;