@offgame/errcodes

offgame http error codes list

Usage no npm install needed!

<script type="module">
  import offgameErrcodes from 'https://cdn.skypack.dev/@offgame/errcodes';
</script>

README

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.' },