Skip to main content

ErrorCode

API Docs


Enumeration: ErrorCode

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

Standardized error codes used across REST and GraphQL endpoints.

This enum provides a unified taxonomy of error types that can occur in the Talawa API. Each error code maps to an appropriate HTTP status code and provides consistent error categorization across different API interfaces.

Example

// Using in REST endpoint
throw new TalawaRestError({
code: ErrorCode.NOT_FOUND,
message: "User not found"
});

// Using in GraphQL resolver
throw new TalawaGraphQLError({
extensions: {
code: ErrorCode.UNAUTHENTICATED
}
});

Enumeration Members

ALREADY_EXISTS

ALREADY_EXISTS: "already_exists"

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

Resource already exists and cannot be created again (HTTP 409)


ARGUMENTS_ASSOCIATED_RESOURCES_NOT_FOUND

ARGUMENTS_ASSOCIATED_RESOURCES_NOT_FOUND: "arguments_associated_resources_not_found"

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

Required associated resources were not found (HTTP 404)


CONFLICT

CONFLICT: "conflict"

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

Request conflicts with current resource state (HTTP 409)


DATABASE_ERROR

DATABASE_ERROR: "database_error"

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

Database operation failed (HTTP 500)


DEPRECATED

DEPRECATED: "deprecated"

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

Using deprecated API features (HTTP 400)


EXTERNAL_SERVICE_ERROR

EXTERNAL_SERVICE_ERROR: "external_service_error"

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

External service is unavailable (HTTP 502)


FORBIDDEN_ACTION

FORBIDDEN_ACTION: "forbidden_action"

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

Legacy error code for forbidden action (HTTP 403)


FORBIDDEN_ACTION_ON_ARGUMENTS_ASSOCIATED_RESOURCES

FORBIDDEN_ACTION_ON_ARGUMENTS_ASSOCIATED_RESOURCES: "forbidden_action_on_arguments_associated_resources"

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

Action is failing because the user is not allowed to perform it on the resources associated to the provided arguments (HTTP 403)


INSUFFICIENT_PERMISSIONS

INSUFFICIENT_PERMISSIONS: "insufficient_permissions"

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

User role is insufficient for the requested action (HTTP 403)


INTERNAL_SERVER_ERROR

INTERNAL_SERVER_ERROR: "internal_server_error"

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

Unexpected server error occurred (HTTP 500)


INVALID_ARGUMENTS

INVALID_ARGUMENTS: "invalid_arguments"

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

Request arguments failed validation (HTTP 400)


INVALID_INPUT

INVALID_INPUT: "invalid_input"

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

Input data validation failed (HTTP 400)


NOT_FOUND

NOT_FOUND: "not_found"

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

Requested resource does not exist (HTTP 404)


RATE_LIMIT_EXCEEDED

RATE_LIMIT_EXCEEDED: "rate_limit_exceeded"

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

Too many requests from client (HTTP 429)


TOKEN_EXPIRED

TOKEN_EXPIRED: "token_expired"

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

JWT token has expired and needs to be refreshed (HTTP 401)


TOKEN_INVALID

TOKEN_INVALID: "token_invalid"

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

JWT token is malformed or invalid (HTTP 401)


UNAUTHENTICATED

UNAUTHENTICATED: "unauthenticated"

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

User must be authenticated to access this resource (HTTP 401)


UNAUTHORIZED

UNAUTHORIZED: "unauthorized"

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

User lacks permission to perform this action (HTTP 403)


UNAUTHORIZED_ACTION_ON_ARGUMENTS_ASSOCIATED_RESOURCES

UNAUTHORIZED_ACTION_ON_ARGUMENTS_ASSOCIATED_RESOURCES: "unauthorized_action_on_arguments_associated_resources"

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

Legacy error code for unauthorized action on associated resources (HTTP 403)


UNEXPECTED

UNEXPECTED: "unexpected"

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

Legacy error code for unexpected server error (HTTP 500)