ccashfrontend/views/node_modules/ccash-client-js/dist/exceptions.js
2021-06-18 09:20:09 +10:00

38 lines
1.6 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExceptionMap = exports.ExceptionCodes = exports.ErrorCodes = exports.InvalidResponseException = exports.InvalidRequestException = exports.BaseUrlMissingException = void 0;
const Exception_1 = require("./Exception");
class BaseUrlMissingException extends Exception_1.Exception {
constructor() {
super('base url missing');
}
}
exports.BaseUrlMissingException = BaseUrlMissingException;
class InvalidRequestException extends Exception_1.Exception {
constructor() {
super('invalid request');
}
}
exports.InvalidRequestException = InvalidRequestException;
class InvalidResponseException extends Exception_1.Exception {
constructor(errors) {
super(`invalid response: ${JSON.stringify(errors, null, 2)}`);
this.errors = errors;
}
}
exports.InvalidResponseException = InvalidResponseException;
var ErrorCodes;
(function (ErrorCodes) {
ErrorCodes[ErrorCodes["UserNotFound"] = -1] = "UserNotFound";
ErrorCodes[ErrorCodes["WrongPassword"] = -2] = "WrongPassword";
ErrorCodes[ErrorCodes["NameTooLong"] = -4] = "NameTooLong";
ErrorCodes[ErrorCodes["UserAlreadyExists"] = -5] = "UserAlreadyExists";
ErrorCodes[ErrorCodes["InsufficientFunds"] = -6] = "InsufficientFunds";
})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
var ExceptionCodes;
(function (ExceptionCodes) {
ExceptionCodes[ExceptionCodes["InvalidRequest"] = -3] = "InvalidRequest";
})(ExceptionCodes = exports.ExceptionCodes || (exports.ExceptionCodes = {}));
exports.ExceptionMap = {
[ExceptionCodes.InvalidRequest]: InvalidRequestException,
};