What is an effective way to track, identify and report every β€œerror message” raised by your application?

In the case of management systems and workflows, this seems to be a lot. The need to provide a complete list of each business message in the "system" and provide its possible reasons (s) and corrective actions.

An example of a provider is Oracle: all of their errors have a naming convention (for example, ORA-00237), and they have fixed all possible errors of ORA-XXXXX).

How do you β€œimpose” this in your development process without creating an excessive burden for the team? Examples of problem domains are software such as applying for a loan, applying for a corporate tax return, determining eligibility for a license, etc.

+1
source share
2 answers

For errors caused by your own application, the general solution for it has a table of error messages like this:

create table errors
    ( error_no integer primary key
    , error_text varchar2(200)
    , error_cause varchar2(4000)
    , error_action varchar2(4000)
    );

A typical entry could be:

insert into errors (error_no, error_text, error_cause, error_action)
values (479, 'End date cannot be earlier than start date',
        'A start date and an end date were entered where the end date was before the start date, which is not allowed.',
        'Correct the start and end dates and retry.'
       );

Then in your code descriptor descriptor something like this:

if p_start_date > p_end_date then
    error_pkg.raise_error (479);
end if;

The package would do something like:

procedure raise_error (p_error_no integer)
is
    l_text errors.error_text%type;
begin
    select error_text into l_text
    from   errors
    where  error_no = p_error_no;
    raise_application_error(-20001, l_text);
end;

The end user will see something like:

ERROR 479: End date cannot be earlier than start date

This can then be found to get information about the causes and actions.

, :

insert into errors (error_no, error_text, error_cause, error_action)
values (456, 'Invalid action code: [1]',
        'An invalid action was specified', 'Correct the action code and retry.'
       );

error_pkg.raise_error (456, p_act_code);
+3

reqirements?

  • - .
  • Uniquifier .
  • uniquifier , , . , , : , ZZ-27B, ...
  • , .
  • . .

- / . , . - , , , " " .

, () :

1). CCC-MM-nnn. CCC - , MM - "", , , Java. nnn - . MM , .

// conceptually like this, but perhaps done with enums or annotations
static final MessageUniquifier  CCC_MM_123 = new MessageUniquifier("CCC_MM_123);

2). logging api

Logger {
  public void logError(MessageUniquifier id, String message) ...

:

  • unquifier , ,
  • uniquifier - uniquifier, , .
  • , , , .
  • ​​ java- ​​ , .
0

Source: https://habr.com/ru/post/1774668/


All Articles