English version
ORA-01400 and ORA-00001 are meaningful to a developer, but they rarely tell an end user what to do next. An APEX error-handling function can translate known failures into useful messages while preserving diagnostic detail for the team.
Initialize the result properly
Use APEXERROR.INITERROR_RESULT with the incoming error record. Oracle recommends this initialization pattern for compatibility with changes to the result type.
Map known business constraints
For a uniqueness error, extract the constraint name and look it up in a controlled mapping. A message such as 'A request with this reference already exists' is more useful than exposing a schema and constraint name. Do not map every uniqueness error to the same field if different constraints represent different rules.
For required values, prefer an item validation that guides the user early. Database constraints should remain the final integrity boundary.
Keep diagnosis possible
Unexpected errors should receive a safe message and a reference that support staff can investigate. Keep stack traces and sensitive details out of the user-facing notification. Logging itself must not make the original failure harder to understand.
Test duplicate values, missing required fields, unexpected exceptions, and errors raised from different page processes. A friendly message should explain a real failure; it must not turn a failed operation into an apparent success.
References: INITERRORRESULT and APEX_ERROR utilities.
