Skip to content
Rüdiger Beck edited this page May 22, 2018 · 3 revisions

ERROR Handling

Error handling includes WARNING handling

ERROR Handling workflow in a script

  1. The result object is initialised:

    my %sophomorix_result=&result_sophomorix_init("sophomorix-check");

  2. The patrameter check adds (extended) names of parameters/arguments (Todo)

  3. The, data is analysed (i.e: devices files), possibly with errors/warning:

    &result_sophomorix_add(\%sophomorix_result,"WARNING|ERROR",EXIT|NOEXIT ...);

  4. Before modifying anything, the script can exit if ERRORS are present:

    &result_sophomorix_check_exit(\%sophomorix_result);

  5. If no errors are encountered, the script will start and log into command.log (parameters/arguments as given):

    &log_script_start(\@arguments,\%sophomorix_result);

  6. While doing its work, the script can log:

    • Add warnings or errors to return->OUTPUT:

      &result_sophomorix_add(\%sophomorix_result,"WARNING|ERROR",EXIT|NOEXIT ...);

    • Add log lines to return->OUTPUT:

      &result_sophomorix_add_log($ref_result," terminated regularly");

  7. Before the end of the script a summary should be added (includig counters that have built up):

    &result_sophomorix_add_summary({...});

  8. The script exits, logging into command.log and showing the messages on console (or as json with -j or -jj)

    &log_script_end(\@arguments,\%sophomorix_result,$json);

Clone this wiki locally