Module: BetterService::ErrorCodes
- Defined in:
- lib/better_service/errors/better_service_error.rb
Overview
Standard error codes used in BetterService responses
These codes are used for both hash responses and exception codes, providing consistent error identification across the system.
Constant Summary collapse
- VALIDATION_FAILED =
Validation failed - input parameters are invalid
Used when Dry::Schema validation fails. The error will include validation details in context.
:validation_failed- UNAUTHORIZED =
Authorization failed - user doesn’t have permission
Used when the authorize_with block returns false.
:unauthorized- SCHEMA_REQUIRED =
Schema is missing or invalid
:schema_required- CONFIGURATION_ERROR =
Service configuration is invalid
:configuration_error- EXECUTION_ERROR =
Unexpected error during service execution
:execution_error- RESOURCE_NOT_FOUND =
Required resource was not found
:resource_not_found- TRANSACTION_ERROR =
Database transaction failed
:transaction_error- DATABASE_ERROR =
Database operation failed (validation errors, save failures)
:database_error- WORKFLOW_FAILED =
Workflow execution failed
:workflow_failed- STEP_FAILED =
Workflow step failed
:step_failed- ROLLBACK_FAILED =
Workflow rollback failed
:rollback_failed- INVALID_RESULT =
Service returned invalid result type (not BetterService::Result)
:invalid_result