ngx-restful-client
Version:
The ultimate Angular library to exquisitely declare and implement the REST APIs you'll use in your application.
116 lines (115 loc) • 4.35 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 (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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var msg = function (candidate) {
var m = 'Erro ao realizar operação.';
if (!!candidate) {
m = candidate;
if (isError(candidate)) {
m = candidate.message;
}
}
return m;
};
var isError = function (e) {
var flg = false;
if (e.stack && e.message) {
flg = true;
}
return flg;
};
var errorOrString = function (e) {
if (e instanceof Error || typeof e === 'string') {
return e;
}
return "Index out of range " + e;
};
//=====================BEGIN DECLARATIONS=====================//
var Throwable = /** @class */ (function (_super) {
__extends(Throwable, _super);
function Throwable(cause, error) {
var _this = _super.call(this, msg(cause)) || this;
_this.cause = (isError(cause) ? cause : !!error ? error : null);
return _this;
}
return Throwable;
}(Error));
exports.Throwable = Throwable;
var RuntimeException = /** @class */ (function (_super) {
__extends(RuntimeException, _super);
function RuntimeException(cause, error) {
return _super.call(this, cause, error) || this;
}
return RuntimeException;
}(Throwable));
exports.RuntimeException = RuntimeException;
var IndexOutOfBoundsException = /** @class */ (function (_super) {
__extends(IndexOutOfBoundsException, _super);
function IndexOutOfBoundsException(cause, error) {
return _super.call(this, errorOrString(cause), error) || this;
}
return IndexOutOfBoundsException;
}(RuntimeException));
exports.IndexOutOfBoundsException = IndexOutOfBoundsException;
var IllegalArgumentsException = /** @class */ (function (_super) {
__extends(IllegalArgumentsException, _super);
function IllegalArgumentsException(cause, error) {
return _super.call(this, cause, error) || this;
}
return IllegalArgumentsException;
}(Throwable));
exports.IllegalArgumentsException = IllegalArgumentsException;
var InstantiationException = /** @class */ (function (_super) {
__extends(InstantiationException, _super);
function InstantiationException(cause, error) {
return _super.call(this, cause, error) || this;
}
return InstantiationException;
}(Throwable));
exports.InstantiationException = InstantiationException;
var NumberFormatException = /** @class */ (function (_super) {
__extends(NumberFormatException, _super);
function NumberFormatException(cause, error) {
return _super.call(this, cause, error) || this;
}
return NumberFormatException;
}(Throwable));
exports.NumberFormatException = NumberFormatException;
var SecurityException = /** @class */ (function (_super) {
__extends(SecurityException, _super);
function SecurityException(cause, error) {
return _super.call(this, cause, error) || this;
}
return SecurityException;
}(Throwable));
exports.SecurityException = SecurityException;
var UnsupportedOperationException = /** @class */ (function (_super) {
__extends(UnsupportedOperationException, _super);
function UnsupportedOperationException(cause, error) {
return _super.call(this, cause, error) || this;
}
return UnsupportedOperationException;
}(Throwable));
exports.UnsupportedOperationException = UnsupportedOperationException;
var WebApplicationException = /** @class */ (function (_super) {
__extends(WebApplicationException, _super);
function WebApplicationException(statusCode, cause, error) {
var _this = _super.call(this, cause, error) || this;
_this.statusCode = statusCode;
return _this;
}
return WebApplicationException;
}(Throwable));
exports.WebApplicationException = WebApplicationException;