Error Handling

SSlib functions and the functions that SSlib calls all indicate errors by returning special values. SSlib code inspects return values and enters an error recovery mode when an error is detected. In order to make the SSlib code base cleaner and to facilitate changes in error handling policies, we use a number of macros. The goal is to have a system that is easy to program, easy to optimize, and easy to read (lean, mean, and clean).

Almost every function will begin and end with SS_ENTER and SS_LEAVE calls. Somewhere in between them will be an SS_CLEANUP label that marks the boundary between normal flow of control and error recovery code. Inside the normal flow of control will be calls to SS_ERROR or SS_ERROR_FMT when an error is detected, or various calls to SS_STATUS macros to get information about an error.

Sometimes, particularly during a parallel run, error recovery is impossible, prohibitively expensive, or unusually complex. In such cases SSlib may call MPI_Abort. (A version of SSlib compiled with MPI support but run with a single MPI task as the library communicator is considered a serial run.)