UNPKG

@iotile/iotile-common

Version:

Common utilities for IoTile Packages and Applications

214 lines 7.59 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /** * @ngdoc object * @name Errors.type:BaseError * @description * The base error class for all exceptions. All exceptions must * have a name that should match the name of their class and a user * settable message. Typically, subclasses of BaseError will fill in the * name field in their own constructor, so users do not have to set it. * * @property {string} name The name of of the exception, which is intended * to be used as a method of filtering different exceptions. * @property {string} message A freeform message that provides more detail * into what caused this error. */ var BaseError = /** @class */ (function () { function BaseError(name, message) { this.name = name; this.message = message; } return BaseError; }()); exports.BaseError = BaseError; /** * @ngdoc object * @name Errors.type:ArgumentError * @description * There was an issue with one of the parameters passed to this function. * The parameter was invalid. The included message should contain more * details about what was expected vs received. */ var ArgumentError = /** @class */ (function (_super) { __extends(ArgumentError, _super); function ArgumentError(message) { return _super.call(this, 'ArgumentError', message) || this; } return ArgumentError; }(BaseError)); exports.ArgumentError = ArgumentError; /** * @ngdoc object * @name Errors.type:InvalidOperationError * @description * The operation could not be performed at the time that it * was requested. This may be because the application's state * did not allow its preconditions to be met. */ var InvalidOperationError = /** @class */ (function (_super) { __extends(InvalidOperationError, _super); function InvalidOperationError(message) { return _super.call(this, 'InvalidOperationError', message) || this; } return InvalidOperationError; }(BaseError)); exports.InvalidOperationError = InvalidOperationError; /** * @ngdoc object * @name Errors.type:UnknownError * @description * There was an unspecified error with the operation. * See the message property for more details. */ var UnknownError = /** @class */ (function (_super) { __extends(UnknownError, _super); function UnknownError(message) { return _super.call(this, 'UnknownError', message) || this; } return UnknownError; }(BaseError)); exports.UnknownError = UnknownError; /** * @ngdoc object * @name Errors.type:InsufficientSpaceError * @description * There was not sufficient space to perform this operation. This error * could be thrown, if, for example, you were trying to append data to a fixed * size buffer and there was not room in the buffer for all the data you wanted * to append. */ var InsufficientSpaceError = /** @class */ (function (_super) { __extends(InsufficientSpaceError, _super); function InsufficientSpaceError(message) { return _super.call(this, 'InsufficientSpaceError', message) || this; } return InsufficientSpaceError; }(BaseError)); exports.InsufficientSpaceError = InsufficientSpaceError; /** * @ngdoc object * @name Errors.type:UnknownKeyError * @description * A key was passed to a lookup table and it was not found. */ var UnknownKeyError = /** @class */ (function (_super) { __extends(UnknownKeyError, _super); function UnknownKeyError(message) { return _super.call(this, 'UnknownKeyError', message) || this; } return UnknownKeyError; }(BaseError)); exports.UnknownKeyError = UnknownKeyError; /** * @ngdoc object * @name Errors.type:FileSystemError * @description * There was an error interacting with the file system on * the device. */ var FileSystemError = /** @class */ (function () { function FileSystemError(name, message, code) { this.name = name; this.message = message; this.code = code; } FileSystemError.NOT_FOUND_ERR = 1; FileSystemError.SECURITY_ERR = 2; FileSystemError.ABORT_ERR = 3; FileSystemError.NOT_READABLE_ERR = 4; FileSystemError.ENCODING_ERR = 5; FileSystemError.NO_MODIFICATION_ALLOWED_ERR = 6; FileSystemError.INVALID_STATE_ERR = 7; FileSystemError.SYNTAX_ERR = 8; FileSystemError.INVALID_MODIFICATION_ERR = 9; FileSystemError.QUOTA_EXCEEDED_ERR = 10; FileSystemError.TYPE_MISMATCH_ERR = 11; FileSystemError.PATH_EXISTS_ERR = 12; return FileSystemError; }()); exports.FileSystemError = FileSystemError; /** * @ngdoc object * @name Errors.type:UnknownFileSystemError * * @description * There was an error interacting with the file system on * the device. */ var UnknownFileSystemError = /** @class */ (function (_super) { __extends(UnknownFileSystemError, _super); function UnknownFileSystemError(code, path) { return _super.call(this, 'UnknownFileSystemError', "Unknown filesystem error: " + code + " path: " + path, code) || this; } return UnknownFileSystemError; }(FileSystemError)); exports.UnknownFileSystemError = UnknownFileSystemError; /** * @ngdoc object * @name Errors.type:BatchOperationError * * @description * A batch operation failed for one or more elements that * were addressed. The individual errors are listed in the * errors property. */ var BatchOperationError = /** @class */ (function () { function BatchOperationError(message, errors) { this.name = "BatchOperationError"; this.message = message; this.errors = errors; } return BatchOperationError; }()); exports.BatchOperationError = BatchOperationError; var InvalidDataError = /** @class */ (function () { function InvalidDataError(name, message) { this.name = name; this.message = message; } return InvalidDataError; }()); exports.InvalidDataError = InvalidDataError; var UserNotLoggedInError = /** @class */ (function () { function UserNotLoggedInError(message) { this.message = message; } return UserNotLoggedInError; }()); exports.UserNotLoggedInError = UserNotLoggedInError; var DataCorruptedError = /** @class */ (function (_super) { __extends(DataCorruptedError, _super); function DataCorruptedError(message) { return _super.call(this, "DataCorruptedError", message) || this; } return DataCorruptedError; }(InvalidDataError)); exports.DataCorruptedError = DataCorruptedError; var DataStaleError = /** @class */ (function (_super) { __extends(DataStaleError, _super); function DataStaleError(message) { return _super.call(this, "DataStaleError", message) || this; } return DataStaleError; }(InvalidDataError)); exports.DataStaleError = DataStaleError; var CorruptDeviceError = /** @class */ (function (_super) { __extends(CorruptDeviceError, _super); function CorruptDeviceError(message) { return _super.call(this, "CorruptDeviceError", message) || this; } return CorruptDeviceError; }(InvalidDataError)); exports.CorruptDeviceError = CorruptDeviceError; //# sourceMappingURL=app-errors.js.map