Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
feat(errors): Add API and docs for new "request blocked" errno 125.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed May 13, 2016
1 parent 1351841 commit d7edef8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ The currently-defined error responses are:
* status code 400, errno 122: account is not locked
* status code 400, errno 123: unknown device
* status code 400, errno 124: session already registered by another device
* status code 400, errno 125: request blocked for security reasons
* status code 400, errno 126: account must be reset
* status code 503, errno 201: service temporarily unavailable to due high load (see [backoff protocol](#backoff-protocol))
* status code 503, errno 202: feature has been disabled for operational reasons
Expand Down
10 changes: 10 additions & 0 deletions lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var ERRNO = {
MISSING_CONTENT_LENGTH_HEADER: 112,
MISSING_PARAMETER: 108,
REQUEST_TOO_LARGE: 113,
REQUEST_BLOCKED: 125,
SERVER_BUSY: 201,
SERVER_CONFIG_ERROR: 100,
THROTTLED: 114,
Expand Down Expand Up @@ -346,6 +347,15 @@ AppError.tooManyRequests = function (retryAfter) {
)
}

AppError.requestBlocked = function () {
return new AppError({
code: 400,
error: 'Request blocked',
errno: ERRNO.REQUEST_BLOCKED,
message: 'The request was blocked for security reasons'
})
}

AppError.serviceUnavailable = function (retryAfter) {
if (!retryAfter) {
retryAfter = 30
Expand Down

0 comments on commit d7edef8

Please sign in to comment.