Errors - linuxmuster/sophomorix4 GitHub Wiki
ERROR Handling
Error handling includes WARNING handling
ERROR Handling workflow in a script
-
The result object is initialised:
my %sophomorix_result=&result_sophomorix_init("sophomorix-check"); -
The patrameter check adds (extended) names of parameters/arguments (Todo)
-
The, data is analysed (i.e: devices files), possibly with errors/warning:
&result_sophomorix_add(\%sophomorix_result,"WARNING|ERROR",EXIT|NOEXIT ...); -
Before modifying anything, the script can exit if ERRORS are present:
&result_sophomorix_check_exit(\%sophomorix_result); -
If no errors are encountered, the script will start and log into
command.log(parameters/arguments as given):&log_script_start(\@arguments,\%sophomorix_result); -
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");
-
-
Before the end of the script a summary should be added (includig counters that have built up):
&result_sophomorix_add_summary({...}); -
The script exits, logging into
command.logand showing the messages on console (or as json with-jor-jj)&log_script_end(\@arguments,\%sophomorix_result,$json);