🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@rxstack/exceptions

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rxstack/exceptions - npm Package Compare versions

Comparing version
0.0.1
to
0.0.2
+8
-2
index.d.ts

@@ -37,5 +37,4 @@ /**

stack?: string;
protected data: any;
data: any;
constructor(message: string);
getData(): any;
}

@@ -231,1 +230,8 @@ /**

}
/**
* Transform an error to exception
*
* @param e
* @returns {Exception}
*/
export declare function transformToException(e: any): Exception;
+14
-3

@@ -11,5 +11,2 @@ "use strict";

}
getData() {
return this.data;
}
}

@@ -316,3 +313,17 @@ exports.Exception = Exception;

exports.ValidationException = ValidationException;
/**
* Transform an error to exception
*
* @param e
* @returns {Exception}
*/
function transformToException(e) {
if (!(e instanceof Exception)) {
e = new Exception(e.message);
e.data = e.stack;
}
return e;
}
exports.transformToException = transformToException;
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;AA8BA;;GAEG;AACH;IAME,YAAmB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAChC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;IAEM,OAAO;QACZ,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAbD,8BAaC;AAED;;GAEG;AACH,mBAAoC,SAAQ,SAAS;IAInD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHP,eAAU,GAAW,GAAG,CAAC;QAIjC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;IAEM,aAAa;QAClB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AAZD,sCAYC;AAED;;GAEG;AACH,yBAAiC,SAAQ,aAAa;IAGpD,YAAY,U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G,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAPD,kEAOC;AAED;;GAEG;AACH,kCAA0C,SAAQ,aAAa;IAG7D,YAAY,UAAkB,sBAAsB;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QAHP,eAAU,GAAW,GAAG,CAAC;QAIjC,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAPD,oEAOC;AAED;;GAEG;AACH,yBAAiC,SAAQ,mBAAmB;IAC1D,YAAY,UAAkB,kBAAkB,EAAE,MAAyB;QACzE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,CAAC;CACF;AALD,kDAKC","file":"index.js","sourcesContent":["/**\n * Copied from https://github.com/pleerock/class-validator\n *\n * Validation error description.\n */\nexport declare class ValidationError {\n /**\n * Object that was validated.\n */\n target: Object;\n /**\n * Object's property that haven't pass validation.\n */\n property: string;\n /**\n * Value that haven't pass a validation.\n */\n value: any;\n /**\n * Constraints that failed validation with error messages.\n */\n constraints: {\n [type: string]: string;\n };\n /**\n * Contains all nested validation errors of the property.\n */\n children: ValidationError[];\n}\n\n/**\n * Defines base Error class\n */\nexport class Exception implements Error {\n name: string;\n stack?: string;\n\n protected data: any;\n\n constructor(public message: string) {\n this.name = 'Exception';\n }\n\n public getData(): any {\n return this.data;\n }\n}\n\n/**\n * Defines Error class for abstract http exception\n */\nexport abstract class HttpException extends Exception {\n\n protected statusCode: number = 500;\n\n constructor(message: string) {\n super(message);\n this.name = 'HttpException';\n }\n\n public getStatusCode(): number {\n return this.statusCode;\n }\n}\n\n/**\n * Defines Error class for Bad Request errors, with HTTP status code 400\n */\nexport class BadRequestException extends HttpException {\n protected statusCode: number = 400;\n\n constructor(message: string = 'Bad Request') {\n super(message);\n this.name = 'BadRequestException';\n }\n}\n\n/**\n * Defines Error class for Unauthorized errors, with HTTP status code 401\n */\nexport class UnauthorizedException extends HttpException {\n protected statusCode: number = 401;\n\n constructor(message: string = 'Unauthorized') {\n super(message);\n this.name = 'UnauthorizedException';\n }\n}\n\n/**\n * Defines Error class for Payment Required errors, with HTTP status code 402\n */\nexport class PaymentRequiredException extends HttpException {\n protected statusCode: number = 402;\n\n constructor(message: string = 'Payment Required') {\n super(message);\n this.name = 'PaymentRequiredException';\n }\n}\n\n/**\n * Defines Error class for Forbidden errors, with HTTP status code 403\n */\nexport class ForbiddenException extends HttpException {\n protected statusCode: number = 403;\n\n constructor(message: string = 'Forbidden') {\n super(message);\n this.name = 'ForbiddenException';\n }\n}\n\n/**\n * Defines Error class for Not Found errors, with HTTP status code 404\n */\nexport class NotFoundException extends HttpException {\n protected statusCode: number = 404;\n\n constructor(message: string = 'Not Found') {\n super(message);\n this.name = 'NotFoundException';\n }\n}\n\n/**\n * Defines Error class for Method Not Allowed errors, with HTTP status code 405\n */\nexport class MethodNotAllowedException extends HttpException {\n protected statusCode: number = 405;\n\n constructor(message: string = 'Method Not Allowed') {\n super(message);\n this.name = 'MethodNotAllowedException';\n }\n}\n\n/**\n * Defines Error class for Not Acceptable errors, with HTTP status code 406\n */\nexport class NotAcceptableException extends HttpException {\n protected statusCode: number = 406;\n\n constructor(message: string = 'Not Acceptable') {\n super(message);\n this.name = 'NotAcceptableException';\n }\n}\n\n/**\n * Defines Error class for Proxy Authentication Required errors, with HTTP status code 407\n */\nexport class ProxyAuthenticationRequiredException extends HttpException {\n protected statusCode: number = 407;\n\n constructor(message: string = 'Proxy Authentication Required') {\n super(message);\n this.name = 'ProxyAuthenticationRequiredException';\n }\n}\n\n/**\n * Defines Error class for Request Timeout errors, with HTTP status code 408\n */\nexport class RequestTimeoutException extends HttpException {\n protected statusCode: number = 408;\n\n constructor(message: string = 'Request Timeout') {\n super(message);\n this.name = 'RequestTimeoutException';\n }\n}\n\n/**\n * Defines Error class for Conflict errors, with HTTP status code 409\n */\nexport class ConflictException extends HttpException {\n protected statusCode: number = 409;\n\n constructor(message: string = 'Conflict') {\n super(message);\n this.name = 'ConflictException';\n }\n}\n\n/**\n * Defines Error class for Gone errors, with HTTP status code 410\n */\nexport class GoneException extends HttpException {\n protected statusCode: number = 410;\n\n constructor(message: string = 'Gone') {\n super(message);\n this.name = 'GoneException';\n }\n}\n\n/**\n * Defines Error class for Length Required errors, with HTTP status code 411\n */\nexport class LengthRequiredException extends HttpException {\n protected statusCode: number = 411;\n\n constructor(message: string = 'Length Required') {\n super(message);\n this.name = 'LengthRequiredException';\n }\n}\n\n/**\n * Defines Error class for Precondition Failed errors, with HTTP status code 412\n */\nexport class PreconditionFailedException extends HttpException {\n protected statusCode: number = 412;\n\n constructor(message: string = 'Precondition Failed') {\n super(message);\n this.name = 'PreconditionFailedException';\n }\n}\n\n/**\n * Defines Error class for Payload Too Large errors, with HTTP status code 413\n */\nexport class PayloadTooLargeException extends HttpException {\n protected statusCode: number = 413;\n\n constructor(message: string = 'Payload Too Large') {\n super(message);\n this.name = 'PayloadTooLargeException';\n }\n}\n\n/**\n * Defines Error class for URI Too Long errors, with HTTP status code 414\n */\nexport class URITooLongException extends HttpException {\n protected statusCode: number = 414;\n\n constructor(message: string = 'URI Too Long') {\n super(message);\n this.name = 'URITooLongException';\n }\n}\n\n/**\n * Defines Error class for Unsupported Media Type errors, with HTTP status code 415\n */\nexport class UnsupportedMediaTypeException extends HttpException {\n protected statusCode: number = 415;\n\n constructor(message: string = 'Unsupported Media Type') {\n super(message);\n this.name = 'UnsupportedMediaTypeException';\n }\n}\n\n/**\n * Defines Error class for Range Not Satisfiable errors, with HTTP status code 416\n */\nexport class RangeNotSatisfiableException extends HttpException {\n protected statusCode: number = 416;\n\n constructor(message: string = 'Range Not Satisfiable') {\n super(message);\n this.name = 'RangeNotSatisfiableException';\n }\n}\n\n/**\n * Defines Error class for Expectation Failed errors, with HTTP status code 417\n */\nexport class ExpectationFailedException extends HttpException {\n protected statusCode: number = 417;\n\n constructor(message: string = 'Expectation Failed') {\n super(message);\n this.name = 'ExpectationFailedException';\n }\n}\n\n/**\n * Defines Error class for Unprocessable Entity errors, with HTTP status code 422\n */\nexport class UnprocessableEntityException extends HttpException {\n protected statusCode: number = 422;\n\n constructor(message: string = 'Unprocessable Entity') {\n super(message);\n this.name = 'UnprocessableEntityException';\n }\n}\n\n/**\n * Defines Error class for Too Many Requests errors, with HTTP status code 429\n */\nexport class TooManyRequestsException extends HttpException {\n protected statusCode: number = 429;\n\n constructor(message: string = 'Too Many Requests') {\n super(message);\n this.name = 'TooManyRequestsException';\n }\n}\n\n/**\n * Defines Error class for Unavailable For Legal Reasons errors, with HTTP status code 451\n */\nexport class UnavailableForLegalReasonsException extends HttpException {\n protected statusCode: number = 451;\n\n constructor(message: string = 'Unavailable For Legal Reasons') {\n super(message);\n this.name = 'UnavailableForLegalReasonsException';\n }\n}\n\n/**\n * Defines Error class for Internal Server Error errors, with HTTP status code 500\n */\nexport class InternalServerErrorException extends HttpException {\n protected statusCode: number = 500;\n\n constructor(message: string = 'Internal Server Error') {\n super(message);\n this.name = 'InternalServerErrorException';\n }\n}\n\n/**\n * Defines Error class for Not Implemented errors, with HTTP status code 501\n */\nexport class NotImplementedException extends HttpException {\n protected statusCode: number = 501;\n\n constructor(message: string = 'Not Implemented') {\n super(message);\n this.name = 'NotImplementedException';\n }\n}\n\n/**\n * Defines Error class for Service Unavailable errors, with HTTP status code 503\n */\nexport class ServiceUnavailableException extends HttpException {\n protected statusCode: number = 503;\n\n constructor(message: string = 'Service Unavailable') {\n super(message);\n this.name = 'ServiceUnavailableException';\n }\n}\n\n/**\n * Defines Error class for Insufficient Storage errors, with HTTP status code 503\n */\nexport class InsufficientStorageException extends HttpException {\n protected statusCode: number = 507;\n\n constructor(message: string = 'Insufficient Storage') {\n super(message);\n this.name = 'InsufficientStorageException';\n }\n}\n\n/**\n * Defines Error class for Validation http-exceptions\n */\nexport class ValidationException extends BadRequestException {\n constructor(message: string = 'Validation error', errors: ValidationError[]) {\n super(message);\n this.data = errors;\n }\n}\n"],"sourceRoot":"."}
{"version":3,"sources":["../../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.js","sourcesContent":["/**\n * Copied from https://github.com/pleerock/class-validator\n *\n * Validation error description.\n */\nexport declare class ValidationError {\n /**\n * Object that was validated.\n */\n target: Object;\n /**\n * Object's property that haven't pass validation.\n */\n property: string;\n /**\n * Value that haven't pass a validation.\n */\n value: any;\n /**\n * Constraints that failed validation with error messages.\n */\n constraints: {\n [type: string]: string;\n };\n /**\n * Contains all nested validation errors of the property.\n */\n children: ValidationError[];\n}\n\n/**\n * Defines base Error class\n */\nexport class Exception implements Error {\n name: string;\n stack?: string;\n data: any;\n\n constructor(public message: string) {\n this.name = 'Exception';\n }\n}\n\n/**\n * Defines Error class for abstract http exception\n */\nexport abstract class HttpException extends Exception {\n\n protected statusCode: number = 500;\n\n constructor(message: string) {\n super(message);\n this.name = 'HttpException';\n }\n\n getStatusCode(): number {\n return this.statusCode;\n }\n}\n\n/**\n * Defines Error class for Bad Request errors, with HTTP status code 400\n */\nexport class BadRequestException extends HttpException {\n protected statusCode: number = 400;\n\n constructor(message: string = 'Bad Request') {\n super(message);\n this.name = 'BadRequestException';\n }\n}\n\n/**\n * Defines Error class for Unauthorized errors, with HTTP status code 401\n */\nexport class UnauthorizedException extends HttpException {\n protected statusCode: number = 401;\n\n constructor(message: string = 'Unauthorized') {\n super(message);\n this.name = 'UnauthorizedException';\n }\n}\n\n/**\n * Defines Error class for Payment Required errors, with HTTP status code 402\n */\nexport class PaymentRequiredException extends HttpException {\n protected statusCode: number = 402;\n\n constructor(message: string = 'Payment Required') {\n super(message);\n this.name = 'PaymentRequiredException';\n }\n}\n\n/**\n * Defines Error class for Forbidden errors, with HTTP status code 403\n */\nexport class ForbiddenException extends HttpException {\n protected statusCode: number = 403;\n\n constructor(message: string = 'Forbidden') {\n super(message);\n this.name = 'ForbiddenException';\n }\n}\n\n/**\n * Defines Error class for Not Found errors, with HTTP status code 404\n */\nexport class NotFoundException extends HttpException {\n protected statusCode: number = 404;\n\n constructor(message: string = 'Not Found') {\n super(message);\n this.name = 'NotFoundException';\n }\n}\n\n/**\n * Defines Error class for Method Not Allowed errors, with HTTP status code 405\n */\nexport class MethodNotAllowedException extends HttpException {\n protected statusCode: number = 405;\n\n constructor(message: string = 'Method Not Allowed') {\n super(message);\n this.name = 'MethodNotAllowedException';\n }\n}\n\n/**\n * Defines Error class for Not Acceptable errors, with HTTP status code 406\n */\nexport class NotAcceptableException extends HttpException {\n protected statusCode: number = 406;\n\n constructor(message: string = 'Not Acceptable') {\n super(message);\n this.name = 'NotAcceptableException';\n }\n}\n\n/**\n * Defines Error class for Proxy Authentication Required errors, with HTTP status code 407\n */\nexport class ProxyAuthenticationRequiredException extends HttpException {\n protected statusCode: number = 407;\n\n constructor(message: string = 'Proxy Authentication Required') {\n super(message);\n this.name = 'ProxyAuthenticationRequiredException';\n }\n}\n\n/**\n * Defines Error class for Request Timeout errors, with HTTP status code 408\n */\nexport class RequestTimeoutException extends HttpException {\n protected statusCode: number = 408;\n\n constructor(message: string = 'Request Timeout') {\n super(message);\n this.name = 'RequestTimeoutException';\n }\n}\n\n/**\n * Defines Error class for Conflict errors, with HTTP status code 409\n */\nexport class ConflictException extends HttpException {\n protected statusCode: number = 409;\n\n constructor(message: string = 'Conflict') {\n super(message);\n this.name = 'ConflictException';\n }\n}\n\n/**\n * Defines Error class for Gone errors, with HTTP status code 410\n */\nexport class GoneException extends HttpException {\n protected statusCode: number = 410;\n\n constructor(message: string = 'Gone') {\n super(message);\n this.name = 'GoneException';\n }\n}\n\n/**\n * Defines Error class for Length Required errors, with HTTP status code 411\n */\nexport class LengthRequiredException extends HttpException {\n protected statusCode: number = 411;\n\n constructor(message: string = 'Length Required') {\n super(message);\n this.name = 'LengthRequiredException';\n }\n}\n\n/**\n * Defines Error class for Precondition Failed errors, with HTTP status code 412\n */\nexport class PreconditionFailedException extends HttpException {\n protected statusCode: number = 412;\n\n constructor(message: string = 'Precondition Failed') {\n super(message);\n this.name = 'PreconditionFailedException';\n }\n}\n\n/**\n * Defines Error class for Payload Too Large errors, with HTTP status code 413\n */\nexport class PayloadTooLargeException extends HttpException {\n protected statusCode: number = 413;\n\n constructor(message: string = 'Payload Too Large') {\n super(message);\n this.name = 'PayloadTooLargeException';\n }\n}\n\n/**\n * Defines Error class for URI Too Long errors, with HTTP status code 414\n */\nexport class URITooLongException extends HttpException {\n protected statusCode: number = 414;\n\n constructor(message: string = 'URI Too Long') {\n super(message);\n this.name = 'URITooLongException';\n }\n}\n\n/**\n * Defines Error class for Unsupported Media Type errors, with HTTP status code 415\n */\nexport class UnsupportedMediaTypeException extends HttpException {\n protected statusCode: number = 415;\n\n constructor(message: string = 'Unsupported Media Type') {\n super(message);\n this.name = 'UnsupportedMediaTypeException';\n }\n}\n\n/**\n * Defines Error class for Range Not Satisfiable errors, with HTTP status code 416\n */\nexport class RangeNotSatisfiableException extends HttpException {\n protected statusCode: number = 416;\n\n constructor(message: string = 'Range Not Satisfiable') {\n super(message);\n this.name = 'RangeNotSatisfiableException';\n }\n}\n\n/**\n * Defines Error class for Expectation Failed errors, with HTTP status code 417\n */\nexport class ExpectationFailedException extends HttpException {\n protected statusCode: number = 417;\n\n constructor(message: string = 'Expectation Failed') {\n super(message);\n this.name = 'ExpectationFailedException';\n }\n}\n\n/**\n * Defines Error class for Unprocessable Entity errors, with HTTP status code 422\n */\nexport class UnprocessableEntityException extends HttpException {\n protected statusCode: number = 422;\n\n constructor(message: string = 'Unprocessable Entity') {\n super(message);\n this.name = 'UnprocessableEntityException';\n }\n}\n\n/**\n * Defines Error class for Too Many Requests errors, with HTTP status code 429\n */\nexport class TooManyRequestsException extends HttpException {\n protected statusCode: number = 429;\n\n constructor(message: string = 'Too Many Requests') {\n super(message);\n this.name = 'TooManyRequestsException';\n }\n}\n\n/**\n * Defines Error class for Unavailable For Legal Reasons errors, with HTTP status code 451\n */\nexport class UnavailableForLegalReasonsException extends HttpException {\n protected statusCode: number = 451;\n\n constructor(message: string = 'Unavailable For Legal Reasons') {\n super(message);\n this.name = 'UnavailableForLegalReasonsException';\n }\n}\n\n/**\n * Defines Error class for Internal Server Error errors, with HTTP status code 500\n */\nexport class InternalServerErrorException extends HttpException {\n protected statusCode: number = 500;\n\n constructor(message: string = 'Internal Server Error') {\n super(message);\n this.name = 'InternalServerErrorException';\n }\n}\n\n/**\n * Defines Error class for Not Implemented errors, with HTTP status code 501\n */\nexport class NotImplementedException extends HttpException {\n protected statusCode: number = 501;\n\n constructor(message: string = 'Not Implemented') {\n super(message);\n this.name = 'NotImplementedException';\n }\n}\n\n/**\n * Defines Error class for Service Unavailable errors, with HTTP status code 503\n */\nexport class ServiceUnavailableException extends HttpException {\n protected statusCode: number = 503;\n\n constructor(message: string = 'Service Unavailable') {\n super(message);\n this.name = 'ServiceUnavailableException';\n }\n}\n\n/**\n * Defines Error class for Insufficient Storage errors, with HTTP status code 503\n */\nexport class InsufficientStorageException extends HttpException {\n protected statusCode: number = 507;\n\n constructor(message: string = 'Insufficient Storage') {\n super(message);\n this.name = 'InsufficientStorageException';\n }\n}\n\n/**\n * Defines Error class for Validation http-exceptions\n */\nexport class ValidationException extends BadRequestException {\n constructor(message: string = 'Validation error', errors: ValidationError[]) {\n super(message);\n this.data = errors;\n }\n}\n\n/**\n * Transform an error to exception\n *\n * @param e\n * @returns {Exception}\n */\nexport function transformToException(e: any): Exception {\n if (!(e instanceof Exception)) {\n e = new Exception(e.message);\n e.data = e.stack;\n }\n return e;\n}\n"],"sourceRoot":"."}
{
"name": "@rxstack/exceptions",
"version": "0.0.1",
"version": "0.0.2",
"description": "RxStack Exceptions Component",

@@ -5,0 +5,0 @@ "private": false,

# @rxstack/exceptions
> The Exceptions component converts error to exceptions.
> The Exceptions component converts error to exception.

@@ -8,3 +8,3 @@ ## Installation

```
npm install @rxstack-exceptions --save
npm install @rxstack/exceptions --save
```

@@ -11,0 +11,0 @@