offgame http error codes list
npm install @offgame/errcodesList of http error codes used across the Offgame services
> Work in conjunction with amn npm package
``javascript
const ofgErrCodes = require('@offgame/errcodes');
throw amn.mw.error(ofgErrCodes.GENERAL.NOT_FOUND);
throw amn.mw.error(ofgErrCodes.ACCOUNT.NOT_FOUND);
throw amn.mw.error({
...ofgErrCodes.GENERAL.NOT_FOUND,
exp: 'custom message to extent error details',
});
`
- General System Errors
- User Account Errors
Prefix GENERAL
#### 4xx CLIENT ERRORS
##### 400 Bad Request
`javascript`
BAD_REQUEST: { status: 400, code: 'BAD_REQUEST', message: 'bad request from client' },
##### 401 Unauthorized
`javascript`
UNAUTHORIZED: { status: 401, code: 'UNAUTHORIZED', message: 'user is not authorized on platform', }
`javascript`
TOKEN_EXPIRED: { status: 401, code: 'UNAUTHORIZED.TOKEN_EXPIRED', message: 'token expired.', }
`javascript`
TOKEN_NOT_PROVIDED: { status: 401, code: 'UNAUTHORIZED TOKEN_NOT_PROVIDED', message: 'token is missing' }
##### 403 Forbidden
`javascript`
FORBIDDEN: { status: 403, code: 'FORBIDDEN', message: 'client request forbidden' }
##### 404 Not Found
Generic resource not found
`javascript`
NOT_FOUND: { status: 404, code: 'NOT_FOUND', message: 'resource not found' }
Url/path not found
`javascript`
PATH_NOT_FOUND: { status: 404, code: 'NOT_FOUND.PATH',, message: 'path is not found' }
##### 409 Conflict
`javascript`
CONFLICT: { status: 409, code: 'CONFLICT', message: 'resource conflict on server-side' }
#### 5xx SERVER ERRORS
##### 500 Internal Server Error
`javascript`
INTERNAL_SERVER_ERROR: { status: 500, code: 'INTERNAL_SERVER_ERROR', message: 'critical server-side internal error' }
##### 501 Not Implemented
`javascript`
NOT_IMPLEMENTED: { status: 501, code: 'NOT_IMPLEMENTED', message: 'functionality is not implemented' }
Prefix ACCOUNT
#### 403 Forbidden
`javascript`
EXISTS: { status: 409, code: 'ACCOUNT.ACCOUNT_EXISTS', message: 'Account already exists.' },
#### 404 Not Found
`javascript``
NOT_FOUND: { status: 409, code: 'ACCOUNT.NOT_FOUND', message: 'Account already exists.' },