ARM error handling and error codes
[Appendix]

Describes ARM error handling philosophy. More...

Describes ARM error handling philosophy.

The error handling philosophy of the ARM specification can be summed up as the following:

"Programmers and system administrators need to know about errors; programs do not."

The practical effect of this philosophy is that applications do not need to check for errors, except when initially loading and linking to a library.

Many functions return an error code that the application may optionally test. If the value is not zero, an error occurred. However, any other data that is returned (in an out parameter) is usable without causing the program to fail, even when an error occurs. The measurements may be useless, but the program will not fail, even if the returned data is passed back to ARM on a later function call.

For example, an application may issue arm_start_transaction() using an ID that has not been registered. The ARM implementation will return a handle that can be input to arm_stop_transaction() without causing the program to fail, and the implementation may return an error code as well. In this case, the ARM implementation will probably discard the measurement data, and note the error in some way, such as writing a message to a log file.

An application that contains programming errors, or that receives invalid data, could generate invalid measurement data. This is a problem that programmers and system administrators should correct. But at runtime there's nothing an application can do about it, so the ARM interface takes the approach of being as unobtrusive as possible, and permitting the application logic to flow normally. Programmers testing programs, and system administrators managing systems using ARM, should check for error reports from ARM implementations.

Applications that want to test the error codes and report the error may use the arm_get_error_message() function to get a character string error message, which could then be written to a log file, for example.

Reserved Error Codes

At present all error return codes are specific to the ARM library. However, a range has been reserved for possible future use. The range is ARM_ERROR_CODE_RESERVED_MIN to ARM_ERROR_CODE_RESERVED_MAX, inclusive. The ARM library must never return an error code in this range, unless the ARM specification assigns a value.

 All Data Structures Files Functions Variables Typedefs Defines