rest-error
Advanced tools
Comparing version 1.2.0 to 1.3.0
56
index.js
@@ -37,3 +37,3 @@ // ## Dependencies | ||
RestError.Deprecated = buildConstructor({ | ||
defaultMessage: 'One or more deprecated features were used in this request', | ||
defaultMessage: 'This request uses a deprecated feature and cannot be processed', | ||
status: 400, | ||
@@ -44,3 +44,3 @@ name: 'Bad Request' | ||
RestError.BadSyntax = buildConstructor({ | ||
defaultMessage: 'The body of this request was invalid and could not be parsed', | ||
defaultMessage: 'The body of the request is invalid and could not be parsed', | ||
status: 400, | ||
@@ -50,4 +50,10 @@ name: 'Bad Request' | ||
RestError.Unauthorized = buildConstructor({ | ||
defaultMessage: 'The requested resource requires authentication', | ||
status: 401, | ||
name: 'Unauthorized' | ||
}); | ||
RestError.Forbidden = buildConstructor({ | ||
defaultMessage: 'The requested action is forbidden', | ||
defaultMessage: 'The requested resource is forbidden', | ||
status: 403, | ||
@@ -81,2 +87,32 @@ name: 'Forbidden' | ||
RestError.Gone = buildConstructor({ | ||
defaultMessage: 'The requested resource is no longer available', | ||
status: 410, | ||
name: 'Gone' | ||
}); | ||
RestError.LengthRequired = buildConstructor({ | ||
defaultMessage: 'The request did not specify the length of its content', | ||
status: 411, | ||
name: 'Length Required' | ||
}); | ||
RestError.PreconditionFailed = buildConstructor({ | ||
defaultMessage: 'The request preconditions cannot be met by the server', | ||
status: 412, | ||
name: 'Precondition Failed' | ||
}); | ||
RestError.RequestEntityTooLarge = buildConstructor({ | ||
defaultMessage: 'The request is larger than the server is willing or able to process', | ||
status: 413, | ||
name: 'Request Entity Too Large' | ||
}); | ||
RestError.RequestUriTooLong = buildConstructor({ | ||
defaultMessage: 'The request URI is too long', | ||
status: 414, | ||
name: 'Request URI Too Long' | ||
}); | ||
RestError.UnsupportedMediaType = buildConstructor({ | ||
@@ -88,2 +124,8 @@ defaultMessage: "The request's content type is unsupported", | ||
RestError.Teapot = buildConstructor({ | ||
defaultMessage: 'You attempted to brew coffee with a teapot ;)', | ||
status: 418, | ||
name: 'I\'m a teapot' | ||
}); | ||
RestError.UnprocessableEntity = deco(function (error) { | ||
@@ -103,4 +145,10 @@ this.message = 'The request entity could not be processed (422).' | ||
RestError.TooManyRequests = buildConstructor({ | ||
defaultMessage: 'The request would have exceeded the rate limit, so it has not been processed', | ||
status: 429, | ||
name: 'Too Many Requests' | ||
}); | ||
RestError.InternalServerError = buildConstructor({ | ||
defaultMessage: 'An unforseen error occurred', | ||
defaultMessage: 'An unforeseen error occurred', | ||
status: 500, | ||
@@ -107,0 +155,0 @@ name: 'Internal Server Error' |
@@ -9,3 +9,3 @@ { | ||
"homepage": "https://github.com/wprl/rest-error", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"main": "index.js", | ||
@@ -12,0 +12,0 @@ "publishConfig": { |
7094
150