Files
appointment-booking-software/src/lib/errors.ts
T
e486072ffa Refactor/error and api handling (#82)
* DB migrations

* Format errors in migrations

* Implemented new error and permission handling.

* Updated and fixed tests

* Update src/routes/api/tenants/[id]/appointments/[appointmentId]/cancel/+server.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/routes/api/tenants/[id]/agents/[agentId]/absences/[absenceId]/+server.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/routes/api/tenants/[id]/channels/+server.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fixed test

* Added error constants

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-18 15:04:06 +02:00

34 lines
1.0 KiB
TypeScript

export const ERRORS = {
BACKEND: {
OBFUSCATED: "Internal server error",
},
VALIDATION: {
INVALID_REQUEST_BODY: "Invalid request body",
},
SECURITY: {
AUTHENTICATION_REQUIRED: "Authentication required",
AUTHORIZATION_FAILED: "Insufficient permissions",
INVALID_PASSKEY_REGISTRATION:
"Invalid passkey registration. Please request a new challenge first.",
EITHER_PASSKEY_OR_PHRASE: "Either passkey or passphrase must be provided",
BOTH_PASSKEY_AND_PHRASE: "Cannot provide both passkey and passphrase",
},
TENANTS: {
NAME_EXISTS: "A tenant with this short name already exists",
NO_TENANT_ID: "No tenant id given",
NOT_FOUND: "Tenant not found",
MISSING_TENANT_OR_AGENT_ID: "Missing tenant or agent ID",
},
CHANNELS: {
NOT_FOUND: "Channel not found",
},
USERS: {
ADMIN_EXISTS: "System was already initialized",
EMAIL_EXISTS: "E-Mail Address already exists",
FAILED_TO_UPDATE: "Failed to update user data",
},
AGENTS: {
NOT_FOUND: "Agent not found",
},
};