Provided is a method, system, and program for handling errors in a service
program including service functions capable of being called from application programs.
A call is received for one service function from a service function call within
one application program. A series of test operations are performed when executing
the service function call. Each test operation returns an identifier if the test
operation failed where each identifier is associated with one error state. If one
test operation failed, then the identifier for the failed test operation is transferred
to an error handling agent, wherein the error handling agent accesses error information
associated with the identifier and generates error information describing a specific
cause of the error that caused the test operation to fail and then returns to the
application program with a generic return code.