123 lines
3.1 KiB
TypeScript
123 lines
3.1 KiB
TypeScript
export const PLATFORM_ERRORS = {
|
|
REQUEST_INVALID: [400, 'Invalid request', 'Request schema validation failed'],
|
|
REQUEST_MALFORMED: [
|
|
400,
|
|
'Malformed request syntax',
|
|
'HTTP request parser rejected input',
|
|
],
|
|
REQUEST_TOO_LARGE: [
|
|
413,
|
|
'Request body exceeds the allowed size',
|
|
'HTTP payload limit exceeded',
|
|
],
|
|
ROUTE_NOT_FOUND: [404, 'API route not found', 'Unmatched HTTP route'],
|
|
AUTH_REQUIRED: [
|
|
401,
|
|
'Authentication is required',
|
|
'Bearer credential missing or malformed',
|
|
],
|
|
AUTH_INVALID_CREDENTIALS: [
|
|
401,
|
|
'Invalid credentials',
|
|
'Login credential verification failed',
|
|
],
|
|
SESSION_INVALID: [
|
|
401,
|
|
'Session is invalid or expired',
|
|
'Session authentication rejected',
|
|
],
|
|
ACCESS_DENIED: [
|
|
403,
|
|
'You do not have permission for this action',
|
|
'Permission check rejected operation',
|
|
],
|
|
SCOPE_DENIED: [
|
|
403,
|
|
'Account scope is not authorized',
|
|
'Transaction principal or organization mismatch',
|
|
],
|
|
RECORD_CONFLICT: [
|
|
409,
|
|
'A record with these details already exists',
|
|
'Database uniqueness conflict',
|
|
],
|
|
REFERENCE_INVALID: [
|
|
409,
|
|
'A related record is unavailable',
|
|
'Database foreign-key constraint rejected operation',
|
|
],
|
|
DATA_CONSTRAINT: [
|
|
409,
|
|
'Operation violates a data integrity rule',
|
|
'Database check constraint rejected operation',
|
|
],
|
|
RECORD_NOT_FOUND: [
|
|
404,
|
|
'Requested record is unavailable',
|
|
'Database record lookup failed',
|
|
],
|
|
DATABASE_BUSY: [
|
|
503,
|
|
'Database is temporarily busy; retry later',
|
|
'Database timeout or connection unavailable',
|
|
],
|
|
TRANSACTION_CONFLICT: [
|
|
409,
|
|
'Concurrent update detected; retry this operation',
|
|
'Database transaction conflict',
|
|
],
|
|
INTERNAL_FAILURE: [
|
|
500,
|
|
'An unexpected error occurred',
|
|
'Unhandled application failure',
|
|
],
|
|
USER_NOT_FOUND: [404, 'User not found', 'Scoped user lookup failed'],
|
|
ROLE_NOT_FOUND: [404, 'Role not found', 'Scoped role lookup failed'],
|
|
ROLE_GRANT_DENIED: [
|
|
403,
|
|
'Cannot grant permissions you do not hold',
|
|
'Role grant would exceed actor permissions',
|
|
],
|
|
ROLE_IMMUTABLE: [
|
|
403,
|
|
'System role is immutable',
|
|
'Attempt to modify protected system role',
|
|
],
|
|
ROLE_ASSIGNMENT_DENIED: [
|
|
403,
|
|
'Cannot change these role assignments',
|
|
'Protected or self role assignment rejected',
|
|
],
|
|
ROLE_SYSTEM_DENIED: [
|
|
403,
|
|
'System role cannot be assigned',
|
|
'Attempt to assign owner role',
|
|
],
|
|
USER_STATUS_DENIED: [
|
|
403,
|
|
'Cannot change this account status',
|
|
'Protected or self approval change rejected',
|
|
],
|
|
OWNER_EXISTS: [
|
|
409,
|
|
'Owner already exists',
|
|
'Installation bootstrap repeated',
|
|
],
|
|
RECOVERY_INVALID: [
|
|
400,
|
|
'Invalid or expired recovery token',
|
|
'Recovery token consumption rejected',
|
|
],
|
|
RECOVERY_UNAVAILABLE: [
|
|
503,
|
|
'Password recovery is not configured',
|
|
'SMTP recovery configuration missing',
|
|
],
|
|
RATE_LIMITED: [429, 'Too many requests', 'Durable request quota exceeded'],
|
|
DATABASE_NOT_READY: [
|
|
503,
|
|
'Service is not ready',
|
|
'Database readiness probe failed',
|
|
],
|
|
} as const;
|