UNPKG

react-native-cos-sdk

Version:
53 lines (52 loc) 2.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IllegalArgumentError = exports.CosXmlServiceError = exports.CosXmlClientError = void 0; function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } class IllegalArgumentError extends Error { constructor(message) { super(message); this.name = "IllegalArgumentError"; } } exports.IllegalArgumentError = IllegalArgumentError; class CosXmlClientError extends Error { constructor(errorCode, message, details) { super(message); _defineProperty(this, "errorCode", void 0); _defineProperty(this, "details", void 0); this.errorCode = errorCode; this.details = details; this.name = errorCode.toString(); this.cause = details; } } exports.CosXmlClientError = CosXmlClientError; class CosXmlServiceError extends Error { constructor(statusCode, httpMsg, requestId, errorCode, errorMessage, serviceName, details) { super(errorMessage); _defineProperty(this, "statusCode", void 0); _defineProperty(this, "httpMsg", void 0); _defineProperty(this, "requestId", void 0); _defineProperty(this, "errorCode", void 0); _defineProperty(this, "errorMessage", void 0); _defineProperty(this, "serviceName", void 0); _defineProperty(this, "details", void 0); this.statusCode = statusCode; this.httpMsg = httpMsg; this.requestId = requestId; this.errorCode = errorCode; this.errorMessage = errorMessage; this.serviceName = serviceName; this.details = details; if (errorCode) { this.name = errorCode.toString(); } this.cause = details; } } exports.CosXmlServiceError = CosXmlServiceError; //# sourceMappingURL=errors.js.map