0.0.20 • Published 4 years ago
@offgame/errcodes v0.0.20
Offgame Error Codes
List of http error codes used across the Offgame services
How to use
Work in conjunction with
amn
npm package
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',
});
List
General system errors
Prefix GENERAL
4xx CLIENT ERRORS
400 Bad Request
BAD_REQUEST: { status: 400, code: 'BAD_REQUEST', message: 'bad request from client' },
401 Unauthorized
UNAUTHORIZED: { status: 401, code: 'UNAUTHORIZED', message: 'user is not authorized on platform', }
TOKEN_EXPIRED: { status: 401, code: 'UNAUTHORIZED.TOKEN_EXPIRED', message: 'token expired.', }
TOKEN_NOT_PROVIDED: { status: 401, code: 'UNAUTHORIZED TOKEN_NOT_PROVIDED', message: 'token is missing' }
403 Forbidden
FORBIDDEN: { status: 403, code: 'FORBIDDEN', message: 'client request forbidden' }
404 Not Found
Generic resource not found
NOT_FOUND: { status: 404, code: 'NOT_FOUND', message: 'resource not found' }
Url/path not found
PATH_NOT_FOUND: { status: 404, code: 'NOT_FOUND.PATH',, message: 'path is not found' }
409 Conflict
CONFLICT: { status: 409, code: 'CONFLICT', message: 'resource conflict on server-side' }
5xx SERVER ERRORS
500 Internal Server Error
INTERNAL_SERVER_ERROR: { status: 500, code: 'INTERNAL_SERVER_ERROR', message: 'critical server-side internal error' }
501 Not Implemented
NOT_IMPLEMENTED: { status: 501, code: 'NOT_IMPLEMENTED', message: 'functionality is not implemented' }
User Account Errors
Prefix ACCOUNT
403 Forbidden
EXISTS: { status: 409, code: 'ACCOUNT.ACCOUNT_EXISTS', message: 'Account already exists.' },
404 Not Found
NOT_FOUND: { status: 409, code: 'ACCOUNT.NOT_FOUND', message: 'Account already exists.' },
0.0.20
4 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.16
5 years ago
0.0.14
5 years ago
0.0.15
5 years ago
0.0.13
5 years ago
0.0.12
5 years ago
0.0.10
5 years ago
0.0.11
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.5
5 years ago
0.0.6
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
5 years ago