Skip to content

Instantly share code, notes, and snippets.

@AndreasPizsa
Created December 8, 2014 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AndreasPizsa/b0099d54849929969800 to your computer and use it in GitHub Desktop.
Save AndreasPizsa/b0099d54849929969800 to your computer and use it in GitHub Desktop.
List of Restify HTTP and REST Error Exceptions
100 restify.errors.ContinueError
101 restify.errors.SwitchingProtocolsError
102 restify.errors.ProcessingError
200 restify.errors.OKError
201 restify.errors.CreatedError
202 restify.errors.AcceptedError
203 restify.errors.Non-AuthoritativeInformationError
204 restify.errors.NoContentError
205 restify.errors.ResetContentError
206 restify.errors.PartialContentError
207 restify.errors.Multi-StatusError
300 restify.errors.MultipleChoicesError
301 restify.errors.MovedPermanentlyError
302 restify.errors.MovedTemporarilyError
303 restify.errors.SeeOtherError
304 restify.errors.NotModifiedError
305 restify.errors.UseProxyError
307 restify.errors.TemporaryRedirectError
400 restify.errors.BadRequestError
401 restify.errors.UnauthorizedError
402 restify.errors.PaymentRequiredError
403 restify.errors.ForbiddenError
404 restify.errors.NotFoundError
405 restify.errors.MethodNotAllowedError
406 restify.errors.NotAcceptableError
407 restify.errors.ProxyAuthenticationRequiredError
408 restify.errors.RequestTime-outError
409 restify.errors.ConflictError
410 restify.errors.GoneError
411 restify.errors.LengthRequiredError
412 restify.errors.PreconditionFailedError
413 restify.errors.RequestEntityTooLargeError
414 restify.errors.RequestURITooLargeError
415 restify.errors.UnsupportedMediaTypeError
416 restify.errors.RequestedRangeNotSatisfiableError
417 restify.errors.ExpectationFailedError
418 restify.errors.ImateapotError
422 restify.errors.UnprocessableEntityError
423 restify.errors.LockedError
424 restify.errors.FailedDependencyError
425 restify.errors.UnorderedCollectionError
426 restify.errors.UpgradeRequiredError
428 restify.errors.PreconditionRequiredError
429 restify.errors.TooManyRequestsError
431 restify.errors.RequestHeaderFieldsTooLargeError
500 restify.errors.InternalServerErrorError
501 restify.errors.NotImplementedError
502 restify.errors.BadGatewayError
503 restify.errors.ServiceUnavailableError
504 restify.errors.GatewayTime-outError
505 restify.errors.HTTPVersionNotSupportedError
506 restify.errors.VariantAlsoNegotiatesError
507 restify.errors.InsufficientStorageError
509 restify.errors.BandwidthLimitExceededError
510 restify.errors.NotExtendedError
511 restify.errors.NetworkAuthenticationRequiredError
400 restify.errors.BadDigestError
405 restify.errors.BadMethodError
500 restify.errors.InternalError
409 restify.errors.InvalidArgumentError
400 restify.errors.InvalidContentError
401 restify.errors.InvalidCredentialsError
400 restify.errors.InvalidHeaderError
400 restify.errors.InvalidVersionError
409 restify.errors.MissingParameterError
403 restify.errors.NotAuthorizedError
412 restify.errors.PreconditionFailedError
400 restify.errors.RequestExpiredError
429 restify.errors.RequestThrottledError
404 restify.errors.ResourceNotFoundError
406 restify.errors.WrongAcceptError
@AndreasPizsa
Copy link
Author

You usually want to use REST errors, as these also return code and message. Do

server.get('/hello/:name', function(req, res, next) {
  return next(new restify.errors.ConflictError("I just don't like you"));
});

See http://mcavage.me/node-restify/#Error-handling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment