1.0.5 • Published 10 years ago

restify-standard-errors v1.0.5

Weekly downloads
4
License
Unlicense
Repository
github
Last release
10 years ago

Restify Standard Errors

Funny Picture

Adds a standard set of API errors Restify framework based on Microsoft MSDN API Error Standards.

Installation

$ npm install restify-standard-errors

In your code put

var errors = require('restify-standard-errors')

Usage

server.get('/register', function(req, res, next) {
  return next(new errors.AccountAlreadyExistsError());
});

Complete List of Errors

Error NameHTTP status codeDescription
ConditionNotMetNot Modified (304)The condition specified in the conditional header(s) was not met for a read operation.
MissingRequiredHeaderBad Request (400)A required HTTP header was not specified.
MissingRequiredXmlNodeBad Request (400)A required XML node was not specified in the request body.
UnsupportedHeaderBad Request (400)One of the HTTP headers specified in the request is not supported.
UnsupportedXmlNodeBad Request (400)One of the XML nodes specified in the request body is not supported.
InvalidHeaderValueBad Request (400)The value provided for one of the HTTP headers was not in the correct format.
InvalidXmlNodeValueBad Request (400)The value provided for one of the XML nodes in the request body was not in the correct format.
MissingRequiredQueryParameterBad Request (400)A required query parameter was not specified for this request.
UnsupportedQueryParameterBad Request (400)One of the query parameters specified in the request URI is not supported.
InvalidQueryParameterValueBad Request (400)An invalid value was specified for one of the query parameters in the request URI.
OutOfRangeQueryParameterValueBad Request (400)A query parameter specified in the request URI is outside the permissible range.
RequestUrlFailedToParseBad Request (400)The url in the request could not be parsed.
InvalidUriBad Request (400)The requested URI does not represent any resource on the server.
InvalidHttpVerbBad Request (400)The HTTP verb specified was not recognized by the server.
EmptyMetadataKeyBad Request (400)The key for one of the metadata key-value pairs is empty.
InvalidXmlDocumentBad Request (400)The specified XML is not syntactically valid.
Md5MismatchBad Request (400)The MD5 value specified in the request did not match the MD5 value calculated by the server.
InvalidMd5Bad Request (400)The MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded.
OutOfRangeInputBad Request (400)One of the request inputs is out of range.
InvalidAuthenticationInfoBad Request (400)The authentication information was not provided in the correct format. Verify the value of Authorization header.
InvalidInputBad Request (400)One of the request inputs is not valid.
InvalidMetadataBad Request (400)The specified metadata is invalid. It includes characters that are not permitted.
InvalidResourceNameBad Request (400)The specifed resource name contains invalid characters.
MetadataTooLargeBad Request (400)The size of the specified metadata exceeds the maximum size permitted.
ConditionHeadersNotSupportedBadRequest (400)Condition headers are not supported.
MultipleConditionHeadersNotSupportedBad Request (400)Multiple condition headers are not supported.
AuthenticationFailedForbidden (403)Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
ResourceNotFoundNot Found (404)The specified resource does not exist.
AccountIsDisabledForbidden (403)The specified account is disabled.
InsufficientAccountPermissionsForbidden (403)The account being accessed does not have sufficient permissions to execute this operation.
UnsupportedHttpVerbMethod Not Allowed (405)The resource doesn't support the specified HTTP verb.
AccountAlreadyExistsConflict (409)The specified account already exists.
AccountBeingCreatedConflict (409)The specified account is in the process of being created.
ResourceAlreadyExistsConflict (409)The specified resource already exists.
ResourceTypeMismatchConflict (409)The specified resource type does not match the type of the existing resource.
MissingContentLengthHeaderLength Required (411)The Content-Length header was not specified.
ConditionNotMetPrecondition Failed (412)The condition specified in the conditional header(s) was not met for a write operation.
RequestBodyTooLargeRequest Entity Too Large (413)The size of the request body exceeds the maximum size permitted.
InvalidRangeRequested Range Not Satisfiable (416)The range specified is invalid for the current size of the resource.
InternalErrorInternal Server Error (500)The server encountered an internal error. Please retry the request.
OperationTimedOutInternal Server Error (500)The operation could not be completed within the permitted time.
ServerBusyService Unavailable (503)The server is currently unable to receive requests. Please retry your request.

The Future?

I want to make it so that if you don't supply a 'message' then it automatically passes the description as a message

License

This work is Unlicensed! That means you can do with it whatever you want, although I hope you send me pull requests.

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago