G-5010: Try to use a error/logging framework for your application.

Critical

Reliability, Reusability, Testability

Reason

Having a framework to raise/handle/log your errors allows you to easily avoid duplicate application error numbers and having different error messages for the same type of error.

This kind of framework should include

  • Logging (different channels like table, mail, file, etc. if needed)
  • Error Raising
  • Multilanguage support if needed
  • Translate ORACLE error messages to a user friendly error text
  • Error repository

Example (bad)

BEGIN
   sys.dbms_output.put_line('START');
   -- some processing
   sys.dbms_output.put_line('END');
END;
/

Example (good)

DECLARE 
  -- see https://github.com/OraOpenSource/Logger
  l_scope logger_logs.scope%type := 'DEMO';
BEGIN
  logger.log('START', l_scope);
  -- some processing
  logger.log('END', l_scope);
END;
/