New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

rest-api-errors

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-api-errors - npm Package Compare versions

Comparing version
1.2.5
to
1.3.0
.idea/$PRODUCT_WORKSPACE_FILE$

Sorry, the diff of this file is not supported yet

+6
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
</component>
</project>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/rest-api-errors.iml" filepath="$PROJECT_DIR$/.idea/rest-api-errors.iml" />
</modules>
</component>
</project>

Sorry, the diff of this file is not supported yet

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
exports.apiErrors = Object.entries({
BadRequest: 400,
Unauthorized: 401,
NotAuthorized: 401,
NoAuth: 401,
PaymentRequired: 402,
Forbidden: 403,
AccessDenied: 403,
NotFound: 404,
MethodNotAllowed: 405,
NotAcceptable: 406,
ProxyAuthenticationRequired: 407,
RequestTimeout: 408,
Conflict: 409,
Duplicate: 409,
Gone: 410,
LengthRequired: 411,
PreconditionFailed: 412,
RequestEntityTooLarge: 413,
EntityTooLarge: 413,
RequestURITooLong: 414,
UnsupportedMediaType: 415,
RequestedRangeNotSatisfiable: 416,
ExpectationFailed: 417,
IAmATeapot: 418,
EnhanceYourCalm: 420,
UnprocessableEntity: 422,
InvalidState: 422,
Locked: 423,
FailedDependency: 424,
ReservedForWebDAV: 425,
UpgradeRequired: 426,
PreconditionRequired: 428,
TooManyRequests: 429,
RequestHeaderFieldsTooLarge: 431,
NoResponse: 444,
RetryWith: 449,
BlockedByWindowsParentalControls: 450,
ClientClosedRequest: 499,
InternalServerError: 500,
NotImplemented: 501,
BadGateway: 502,
ServiceUnavailable: 503,
GatewayTimeout: 504,
HttpVersionNotSupported: 505,
VariantAlsoNegotiates: 506,
InsufficientStorage: 507,
LoopDetected: 508,
BandwidthLimitExceeded: 509,
NotExtended: 510,
NetworkAuthenticationRequired: 511,
NetworkReadTimeout: 598,
NetworkConnectionTimeout: 599,
})
#!/usr/bin/env node
const {apiErrors} = require('./errors');
const fs = require('node:fs/promises');
const uniq = require('uniq');
;(async () => {
const definitions = uniq(apiErrors.map(([name, status]) => [
exportify(status, `Http${status}Error`),
exportify(status, `${name}Error`),
exportify(status, `${name}`),
]).flat()).join('\n');
await fs.writeFile('./index.d.ts',
`declare module "rest-api-errors" {
export class APIError extends Error {
public status: number;
public code: string;
public message: string;
constructor(status: number, code?: string, message?: string);
}
${definitions}
}`, 'utf-8');
})()
function exportify(code, name) {
return `
/**
* http ${code} error
*/
export class ${name} extends APIError {
constructor(code?: string, message?: string);
}`
}
declare module "rest-api-errors" {
export class APIError extends Error {
public status: number;
public code: string;
public message: string;
constructor(status: number, code?: string, message?: string);
}
/**
* http 400 error
*/
export class BadRequest extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 400 error
*/
export class BadRequestError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 400 error
*/
export class Http400Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class Http401Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NoAuth extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NoAuthError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NotAuthorized extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NotAuthorizedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class Unauthorized extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class UnauthorizedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class Http402Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class PaymentRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class PaymentRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class AccessDenied extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class AccessDeniedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class Forbidden extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class ForbiddenError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class Http403Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class Http404Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class NotFound extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class NotFoundError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 405 error
*/
export class Http405Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 405 error
*/
export class MethodNotAllowed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 405 error
*/
export class MethodNotAllowedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 406 error
*/
export class Http406Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 406 error
*/
export class NotAcceptable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 406 error
*/
export class NotAcceptableError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 407 error
*/
export class Http407Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 407 error
*/
export class ProxyAuthenticationRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 407 error
*/
export class ProxyAuthenticationRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 408 error
*/
export class Http408Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 408 error
*/
export class RequestTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 408 error
*/
export class RequestTimeoutError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class Conflict extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class ConflictError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class Duplicate extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class DuplicateError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class Http409Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 410 error
*/
export class Gone extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 410 error
*/
export class GoneError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 410 error
*/
export class Http410Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class Http411Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class LengthRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class LengthRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 412 error
*/
export class Http412Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 412 error
*/
export class PreconditionFailed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 412 error
*/
export class PreconditionFailedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class EntityTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class EntityTooLargeError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class Http413Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class RequestEntityTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class RequestEntityTooLargeError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class Http414Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class RequestURITooLong extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class RequestURITooLongError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 415 error
*/
export class Http415Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 415 error
*/
export class UnsupportedMediaType extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 415 error
*/
export class UnsupportedMediaTypeError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 416 error
*/
export class Http416Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 416 error
*/
export class RequestedRangeNotSatisfiable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 416 error
*/
export class RequestedRangeNotSatisfiableError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 417 error
*/
export class ExpectationFailed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 417 error
*/
export class ExpectationFailedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 417 error
*/
export class Http417Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class Http418Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class IAmATeapot extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class IAmATeapotError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 420 error
*/
export class EnhanceYourCalm extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 420 error
*/
export class EnhanceYourCalmError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 420 error
*/
export class Http420Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class Http422Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class InvalidState extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class InvalidStateError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class UnprocessableEntity extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class UnprocessableEntityError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class Http423Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class Locked extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class LockedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 424 error
*/
export class FailedDependency extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 424 error
*/
export class FailedDependencyError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 424 error
*/
export class Http424Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class Http425Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class ReservedForWebDAV extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class ReservedForWebDAVError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 426 error
*/
export class Http426Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 426 error
*/
export class UpgradeRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 426 error
*/
export class UpgradeRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 428 error
*/
export class Http428Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 428 error
*/
export class PreconditionRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 428 error
*/
export class PreconditionRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 429 error
*/
export class Http429Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 429 error
*/
export class TooManyRequests extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 429 error
*/
export class TooManyRequestsError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 431 error
*/
export class Http431Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 431 error
*/
export class RequestHeaderFieldsTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 431 error
*/
export class RequestHeaderFieldsTooLargeError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 444 error
*/
export class Http444Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 444 error
*/
export class NoResponse extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 444 error
*/
export class NoResponseError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 449 error
*/
export class Http449Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 449 error
*/
export class RetryWith extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 449 error
*/
export class RetryWithError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 450 error
*/
export class BlockedByWindowsParentalControls extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 450 error
*/
export class BlockedByWindowsParentalControlsError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 450 error
*/
export class Http450Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 499 error
*/
export class ClientClosedRequest extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 499 error
*/
export class ClientClosedRequestError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 499 error
*/
export class Http499Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class Http500Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class InternalServerError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class InternalServerErrorError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 501 error
*/
export class Http501Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 501 error
*/
export class NotImplemented extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 501 error
*/
export class NotImplementedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 502 error
*/
export class BadGateway extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 502 error
*/
export class BadGatewayError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 502 error
*/
export class Http502Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class Http503Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class ServiceUnavailable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class ServiceUnavailableError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 504 error
*/
export class GatewayTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 504 error
*/
export class GatewayTimeoutError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 504 error
*/
export class Http504Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class Http505Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class HttpVersionNotSupported extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class HttpVersionNotSupportedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 506 error
*/
export class Http506Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 506 error
*/
export class VariantAlsoNegotiates extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 506 error
*/
export class VariantAlsoNegotiatesError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 507 error
*/
export class Http507Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 507 error
*/
export class InsufficientStorage extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 507 error
*/
export class InsufficientStorageError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 508 error
*/
export class Http508Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 508 error
*/
export class LoopDetected extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 508 error
*/
export class LoopDetectedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 509 error
*/
export class BandwidthLimitExceeded extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 509 error
*/
export class BandwidthLimitExceededError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 509 error
*/
export class Http509Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class Http510Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class NotExtended extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class NotExtendedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 511 error
*/
export class Http511Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 511 error
*/
export class NetworkAuthenticationRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 511 error
*/
export class NetworkAuthenticationRequiredError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 598 error
*/
export class Http598Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 598 error
*/
export class NetworkReadTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 598 error
*/
export class NetworkReadTimeoutError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 599 error
*/
export class Http599Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 599 error
*/
export class NetworkConnectionTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 599 error
*/
export class NetworkConnectionTimeoutError extends APIError {
constructor(code?: string, message?: string);
}
}
+848
-7

@@ -8,3 +8,13 @@ declare module "rest-api-errors" {

}
/**
* http 400 error
*/
export class BadRequest extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 400 error
*/
export class BadRequestError extends APIError {

@@ -14,10 +24,26 @@ constructor(code?: string, message?: string);

export class UnauthorizedError extends APIError {
/**
* http 400 error
*/
export class Http400Error extends APIError {
constructor(code?: string, message?: string);
}
export class NotAuthorizedError extends APIError {
/**
* http 401 error
*/
export class Http401Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NoAuth extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NoAuthError extends APIError {

@@ -27,2 +53,47 @@ constructor(code?: string, message?: string);

/**
* http 401 error
*/
export class NotAuthorized extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class NotAuthorizedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class Unauthorized extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 401 error
*/
export class UnauthorizedError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class Http402Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class PaymentRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 402 error
*/
export class PaymentRequiredError extends APIError {

@@ -32,6 +103,12 @@ constructor(code?: string, message?: string);

export class ForbiddenError extends APIError {
/**
* http 403 error
*/
export class AccessDenied extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class AccessDeniedError extends APIError {

@@ -41,2 +118,40 @@ constructor(code?: string, message?: string);

/**
* http 403 error
*/
export class Forbidden extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class ForbiddenError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 403 error
*/
export class Http403Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class Http404Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class NotFound extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 404 error
*/
export class NotFoundError extends APIError {

@@ -46,2 +161,19 @@ constructor(code?: string, message?: string);

/**
* http 405 error
*/
export class Http405Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 405 error
*/
export class MethodNotAllowed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 405 error
*/
export class MethodNotAllowedError extends APIError {

@@ -51,2 +183,19 @@ constructor(code?: string, message?: string);

/**
* http 406 error
*/
export class Http406Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 406 error
*/
export class NotAcceptable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 406 error
*/
export class NotAcceptableError extends APIError {

@@ -56,2 +205,19 @@ constructor(code?: string, message?: string);

/**
* http 407 error
*/
export class Http407Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 407 error
*/
export class ProxyAuthenticationRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 407 error
*/
export class ProxyAuthenticationRequiredError extends APIError {

@@ -61,2 +227,19 @@ constructor(code?: string, message?: string);

/**
* http 408 error
*/
export class Http408Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 408 error
*/
export class RequestTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 408 error
*/
export class RequestTimeoutError extends APIError {

@@ -66,2 +249,12 @@ constructor(code?: string, message?: string);

/**
* http 409 error
*/
export class Conflict extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class ConflictError extends APIError {

@@ -71,2 +264,12 @@ constructor(code?: string, message?: string);

/**
* http 409 error
*/
export class Duplicate extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 409 error
*/
export class DuplicateError extends APIError {

@@ -76,2 +279,19 @@ constructor(code?: string, message?: string);

/**
* http 409 error
*/
export class Http409Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 410 error
*/
export class Gone extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 410 error
*/
export class GoneError extends APIError {

@@ -81,2 +301,26 @@ constructor(code?: string, message?: string);

/**
* http 410 error
*/
export class Http410Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class Http411Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class LengthRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 411 error
*/
export class LengthRequiredError extends APIError {

@@ -86,2 +330,19 @@ constructor(code?: string, message?: string);

/**
* http 412 error
*/
export class Http412Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 412 error
*/
export class PreconditionFailed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 412 error
*/
export class PreconditionFailedError extends APIError {

@@ -91,6 +352,12 @@ constructor(code?: string, message?: string);

export class RequestEntityTooLargeError extends APIError {
/**
* http 413 error
*/
export class EntityTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class EntityTooLargeError extends APIError {

@@ -100,2 +367,40 @@ constructor(code?: string, message?: string);

/**
* http 413 error
*/
export class Http413Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class RequestEntityTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 413 error
*/
export class RequestEntityTooLargeError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class Http414Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class RequestURITooLong extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 414 error
*/
export class RequestURITooLongError extends APIError {

@@ -105,2 +410,19 @@ constructor(code?: string, message?: string);

/**
* http 415 error
*/
export class Http415Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 415 error
*/
export class UnsupportedMediaType extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 415 error
*/
export class UnsupportedMediaTypeError extends APIError {

@@ -110,2 +432,19 @@ constructor(code?: string, message?: string);

/**
* http 416 error
*/
export class Http416Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 416 error
*/
export class RequestedRangeNotSatisfiable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 416 error
*/
export class RequestedRangeNotSatisfiableError extends APIError {

@@ -115,2 +454,12 @@ constructor(code?: string, message?: string);

/**
* http 417 error
*/
export class ExpectationFailed extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 417 error
*/
export class ExpectationFailedError extends APIError {

@@ -120,2 +469,26 @@ constructor(code?: string, message?: string);

/**
* http 417 error
*/
export class Http417Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class Http418Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class IAmATeapot extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 418 error
*/
export class IAmATeapotError extends APIError {

@@ -125,2 +498,12 @@ constructor(code?: string, message?: string);

/**
* http 420 error
*/
export class EnhanceYourCalm extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 420 error
*/
export class EnhanceYourCalmError extends APIError {

@@ -130,6 +513,26 @@ constructor(code?: string, message?: string);

export class UnprocessableEntityError extends APIError {
/**
* http 420 error
*/
export class Http420Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class Http422Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class InvalidState extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class InvalidStateError extends APIError {

@@ -139,2 +542,33 @@ constructor(code?: string, message?: string);

/**
* http 422 error
*/
export class UnprocessableEntity extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 422 error
*/
export class UnprocessableEntityError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class Http423Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class Locked extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 423 error
*/
export class LockedError extends APIError {

@@ -144,2 +578,12 @@ constructor(code?: string, message?: string);

/**
* http 424 error
*/
export class FailedDependency extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 424 error
*/
export class FailedDependencyError extends APIError {

@@ -149,2 +593,26 @@ constructor(code?: string, message?: string);

/**
* http 424 error
*/
export class Http424Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class Http425Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class ReservedForWebDAV extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 425 error
*/
export class ReservedForWebDAVError extends APIError {

@@ -154,2 +622,19 @@ constructor(code?: string, message?: string);

/**
* http 426 error
*/
export class Http426Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 426 error
*/
export class UpgradeRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 426 error
*/
export class UpgradeRequiredError extends APIError {

@@ -159,2 +644,19 @@ constructor(code?: string, message?: string);

/**
* http 428 error
*/
export class Http428Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 428 error
*/
export class PreconditionRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 428 error
*/
export class PreconditionRequiredError extends APIError {

@@ -164,2 +666,19 @@ constructor(code?: string, message?: string);

/**
* http 429 error
*/
export class Http429Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 429 error
*/
export class TooManyRequests extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 429 error
*/
export class TooManyRequestsError extends APIError {

@@ -169,2 +688,19 @@ constructor(code?: string, message?: string);

/**
* http 431 error
*/
export class Http431Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 431 error
*/
export class RequestHeaderFieldsTooLarge extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 431 error
*/
export class RequestHeaderFieldsTooLargeError extends APIError {

@@ -174,2 +710,19 @@ constructor(code?: string, message?: string);

/**
* http 444 error
*/
export class Http444Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 444 error
*/
export class NoResponse extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 444 error
*/
export class NoResponseError extends APIError {

@@ -179,2 +732,19 @@ constructor(code?: string, message?: string);

/**
* http 449 error
*/
export class Http449Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 449 error
*/
export class RetryWith extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 449 error
*/
export class RetryWithError extends APIError {

@@ -184,2 +754,12 @@ constructor(code?: string, message?: string);

/**
* http 450 error
*/
export class BlockedByWindowsParentalControls extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 450 error
*/
export class BlockedByWindowsParentalControlsError extends APIError {

@@ -189,2 +769,19 @@ constructor(code?: string, message?: string);

/**
* http 450 error
*/
export class Http450Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 499 error
*/
export class ClientClosedRequest extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 499 error
*/
export class ClientClosedRequestError extends APIError {

@@ -194,2 +791,26 @@ constructor(code?: string, message?: string);

/**
* http 499 error
*/
export class Http499Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class Http500Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class InternalServerError extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 500 error
*/
export class InternalServerErrorError extends APIError {

@@ -199,2 +820,19 @@ constructor(code?: string, message?: string);

/**
* http 501 error
*/
export class Http501Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 501 error
*/
export class NotImplemented extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 501 error
*/
export class NotImplementedError extends APIError {

@@ -204,2 +842,12 @@ constructor(code?: string, message?: string);

/**
* http 502 error
*/
export class BadGateway extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 502 error
*/
export class BadGatewayError extends APIError {

@@ -209,2 +857,26 @@ constructor(code?: string, message?: string);

/**
* http 502 error
*/
export class Http502Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class Http503Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class ServiceUnavailable extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 503 error
*/
export class ServiceUnavailableError extends APIError {

@@ -214,2 +886,12 @@ constructor(code?: string, message?: string);

/**
* http 504 error
*/
export class GatewayTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 504 error
*/
export class GatewayTimeoutError extends APIError {

@@ -219,2 +901,26 @@ constructor(code?: string, message?: string);

/**
* http 504 error
*/
export class Http504Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class Http505Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class HttpVersionNotSupported extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 505 error
*/
export class HttpVersionNotSupportedError extends APIError {

@@ -224,2 +930,19 @@ constructor(code?: string, message?: string);

/**
* http 506 error
*/
export class Http506Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 506 error
*/
export class VariantAlsoNegotiates extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 506 error
*/
export class VariantAlsoNegotiatesError extends APIError {

@@ -229,2 +952,19 @@ constructor(code?: string, message?: string);

/**
* http 507 error
*/
export class Http507Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 507 error
*/
export class InsufficientStorage extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 507 error
*/
export class InsufficientStorageError extends APIError {

@@ -234,2 +974,19 @@ constructor(code?: string, message?: string);

/**
* http 508 error
*/
export class Http508Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 508 error
*/
export class LoopDetected extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 508 error
*/
export class LoopDetectedError extends APIError {

@@ -239,2 +996,12 @@ constructor(code?: string, message?: string);

/**
* http 509 error
*/
export class BandwidthLimitExceeded extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 509 error
*/
export class BandwidthLimitExceededError extends APIError {

@@ -244,2 +1011,26 @@ constructor(code?: string, message?: string);

/**
* http 509 error
*/
export class Http509Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class Http510Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class NotExtended extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 510 error
*/
export class NotExtendedError extends APIError {

@@ -249,2 +1040,19 @@ constructor(code?: string, message?: string);

/**
* http 511 error
*/
export class Http511Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 511 error
*/
export class NetworkAuthenticationRequired extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 511 error
*/
export class NetworkAuthenticationRequiredError extends APIError {

@@ -254,2 +1062,19 @@ constructor(code?: string, message?: string);

/**
* http 598 error
*/
export class Http598Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 598 error
*/
export class NetworkReadTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 598 error
*/
export class NetworkReadTimeoutError extends APIError {

@@ -259,6 +1084,22 @@ constructor(code?: string, message?: string);

/**
* http 599 error
*/
export class Http599Error extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 599 error
*/
export class NetworkConnectionTimeout extends APIError {
constructor(code?: string, message?: string);
}
/**
* http 599 error
*/
export class NetworkConnectionTimeoutError extends APIError {
constructor(code?: string, message?: string);
}
}
}
+4
-55

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

const {apiErrors} = require('./errors')
class APIError {

@@ -9,58 +11,5 @@ constructor(status, code, message) {

const apiErrors = Object.entries({
BadRequest: 400,
Unauthorized: 401,
NotAuthorized: 401,
NoAuth: 401,
PaymentRequired: 402,
Forbidden: 403,
AccessDenied: 403,
NotFound: 404,
MethodNotAllowed: 405,
NotAcceptable: 406,
ProxyAuthenticationRequired: 407,
RequestTimeout: 408,
Conflict: 409,
Duplicate: 409,
Gone: 410,
LengthRequired: 411,
PreconditionFailed: 412,
RequestEntityTooLarge: 413,
EntityTooLarge: 413,
RequestURITooLong: 414,
UnsupportedMediaType: 415,
RequestedRangeNotSatisfiable: 416,
ExpectationFailed: 417,
IAmATeapot: 418,
EnhanceYourCalm: 420,
UnprocessableEntity: 422,
InvalidState: 422,
Locked: 423,
FailedDependency: 424,
ReservedForWebDAV: 425,
UpgradeRequired: 426,
PreconditionRequired: 428,
TooManyRequests: 429,
RequestHeaderFieldsTooLarge: 431,
NoResponse: 444,
RetryWith: 449,
BlockedByWindowsParentalControls: 450,
ClientClosedRequest: 499,
InternalServerError: 500,
NotImplemented: 501,
BadGateway: 502,
ServiceUnavailable: 503,
GatewayTimeout: 504,
HttpVersionNotSupported: 505,
VariantAlsoNegotiates: 506,
InsufficientStorage: 507,
LoopDetected: 508,
BandwidthLimitExceeded: 509,
NotExtended: 510,
NetworkAuthenticationRequired: 511,
NetworkReadTimeout: 598,
NetworkConnectionTimeout: 599,
}).reduce((map, [name, status]) => {
apiErrors.reduce((map, [name, status]) => {
map[`${name}Error`] = map[name] = class extends APIError {
map[`Http${status}Error`] = map[`${name}Error`] = map[name] = class extends APIError {
constructor(code, message) {

@@ -67,0 +16,0 @@ super(status, code, message);

{
"name": "rest-api-errors",
"version": "1.2.5",
"version": "1.3.0",
"description": "Common errors that can be thrown to simplify promise based api implementations",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"prepublishOnly": "./generateTypes.js",
"generate:types": "./generateTypes.js"
},

@@ -27,3 +28,6 @@ "keywords": [

},
"homepage": "https://github.com/blakgeek/rest-api-errors"
"homepage": "https://github.com/blakgeek/rest-api-errors",
"devDependencies": {
"uniq": "^1.0.1"
}
}