Skip to main content

ERROR_CODE_TO_HTTP_STATUS

API Docs


Variable: ERROR_CODE_TO_HTTP_STATUS

const ERROR_CODE_TO_HTTP_STATUS: Record<ErrorCode, number>

Defined in: src/utilities/errors/errorCodes.ts:89

Maps ErrorCode enum values to their corresponding HTTP status codes.

This mapping ensures consistent HTTP status codes are returned for each error type across both REST and GraphQL endpoints.

Example​

const statusCode = ERROR_CODE_TO_HTTP_STATUS[ErrorCode.NOT_FOUND]; // 404
const authStatus = ERROR_CODE_TO_HTTP_STATUS[ErrorCode.UNAUTHENTICATED]; // 401