12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- 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 (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- export var QiniuErrorName;
- (function (QiniuErrorName) {
- // 输入错误
- QiniuErrorName["InvalidFile"] = "InvalidFile";
- QiniuErrorName["InvalidToken"] = "InvalidToken";
- QiniuErrorName["InvalidMetadata"] = "InvalidMetadata";
- QiniuErrorName["InvalidChunkSize"] = "InvalidChunkSize";
- QiniuErrorName["InvalidCustomVars"] = "InvalidCustomVars";
- QiniuErrorName["NotAvailableUploadHost"] = "NotAvailableUploadHost";
- // 缓存相关
- QiniuErrorName["ReadCacheFailed"] = "ReadCacheFailed";
- QiniuErrorName["InvalidCacheData"] = "InvalidCacheData";
- QiniuErrorName["WriteCacheFailed"] = "WriteCacheFailed";
- QiniuErrorName["RemoveCacheFailed"] = "RemoveCacheFailed";
- // 图片压缩模块相关
- QiniuErrorName["GetCanvasContextFailed"] = "GetCanvasContextFailed";
- QiniuErrorName["UnsupportedFileType"] = "UnsupportedFileType";
- // 运行环境相关
- QiniuErrorName["FileReaderReadFailed"] = "FileReaderReadFailed";
- QiniuErrorName["NotAvailableXMLHttpRequest"] = "NotAvailableXMLHttpRequest";
- QiniuErrorName["InvalidProgressEventTarget"] = "InvalidProgressEventTarget";
- // 请求错误
- QiniuErrorName["RequestError"] = "RequestError";
- })(QiniuErrorName || (QiniuErrorName = {}));
- var QiniuError = /** @class */ (function () {
- function QiniuError(name, message) {
- this.name = name;
- this.message = message;
- this.stack = new Error().stack;
- }
- return QiniuError;
- }());
- export { QiniuError };
- var QiniuRequestError = /** @class */ (function (_super) {
- __extends(QiniuRequestError, _super);
- function QiniuRequestError(code, reqId, message, data) {
- var _this = _super.call(this, QiniuErrorName.RequestError, message) || this;
- _this.code = code;
- _this.reqId = reqId;
- /**
- * @description 标记当前的 error 类型是一个 QiniuRequestError
- * @deprecated 下一个大版本将会移除,不推荐使用,推荐直接使用 instanceof 进行判断
- */
- _this.isRequestError = true;
- _this.data = data;
- return _this;
- }
- return QiniuRequestError;
- }(QiniuError));
- export { QiniuRequestError };
- /**
- * @description 由于跨域、证书错误、断网、host 解析失败、系统拦截等原因导致的错误
- */
- var QiniuNetworkError = /** @class */ (function (_super) {
- __extends(QiniuNetworkError, _super);
- function QiniuNetworkError(message, reqId) {
- if (reqId === void 0) { reqId = ''; }
- return _super.call(this, 0, reqId, message) || this;
- }
- return QiniuNetworkError;
- }(QiniuRequestError));
- export { QiniuNetworkError };
- //# sourceMappingURL=index.js.map
|