Exception : tibemsErrorContext

tibemsErrorContext
Type
Purpose
Enable additional error tracking
Remarks
The tibemsErrorContext objects collect additional error information beyond the status returned by most EMS calls. When a tibemsErrorContext is created, EMS records detailed error information and a stack trace for the last error detected inside the EMS client library. Upon encountering an EMS error, the error information is written to the tibemsErrorContext object and then cleared at the start of the next public EMS function call.
Because each thread of execution in an application may contain specific error information, tibemsErrorContext objects should be created at the start of each thread and then destroyed before exiting the thread. Threads spawned internally by EMS will automatically create tibemsErrorContext objects.
 
tibemsErrorContext_Create
Function
Purpose
Create a new error context object.
C Declaration
tibems_status tibemsErrorContext_Create(
    tibemsErrorContext* errorContext);
COBOL Call
CALL "tibemsErrorContext_Create"
   USING BY REFERENCE errorContext,
   RETURNING tibems-status
END-CALL.
Parameters
 
Remarks
Create a new error context object and enables detailed error information and stack tracing for the thread that calls this function.
Returns TIBEMS_OK, TIBEMS_INVALID_ARG, or TIBEMS_NO_MEMORY.
See Also
tibemsErrorContext_Close on page 527
tibemsErrorContext_Close
Function
Purpose
Close and free memory associated with an error context.
C Declaration
tibems_status tibemsErrorContext_Close(
    tibemsErrorContext errorContext);
COBOL Call
CALL "tibemsErrorContext_Close"
   USING BY VALUE errorContext,
   RETURNING tibems-status
END-CALL.
Parameters
 
Remarks
Returns TIBEMS_OK, TIBEMS_INVALID_ARG.
See Also
tibemsErrorContext_Create on page 526
tibemsErrorContext_GetLastErrorString
Purpose
Retrieve any available detailed error string associated with the last EMS call.
C Declaration
tibems_status tibemsErrorContext_GetLastErrorString(
    tibemsErrorContext errorContext,
    const char** string);
COBOL Call
CALL "tibemsErrorContext_GetLastErrorString"
   USING BY VALUE errorContext,
       BY REFERENCE string,
   RETURNING tibems-status
END-CALL.
Parameters
 
Remarks
Error string includes the day and time the error occurred.
Passing NULL for the errorContext parameter will default to the error context of the current thread. This is useful for retrieving information from within a listener or exception callback. This function returns a pointer, not a copy of the error string. If the last call was considered a non-error, an empty string is returned.
Returns TIBEMS_OK, TIBEMS_INVALID_ARG (string is null, or passing an object created in a different thread), TIBEMS_NOT_INITIALIZED (no error context for this thread)
See Also
tibemsErrorContext_GetLastErrorStackTrace on page 529
tibemsErrorContext_GetLastErrorStackTrace
Purpose
Retrieve a stack trace associated with the last EMS call.
C Declaration
tibems_status tibemsErrorContext_GetLastErrorStackTrace(
    tibemsErrorContext errorContext,
    const char** string);
COBOL Call
CALL "tibemsErrorContext_GetLastErrorStackTrace"
   USING BY VALUE errorContext,
       BY REFERENCE string,
   RETURNING tibems-status
END-CALL.
Parameters
 
Remarks
Passing NULL for the errorContext parameter will default to the error context of the current thread. This is useful for retrieving information from within a listener or exception callback. This function returns a pointer, not a copy of the stack trace string. If the last call was considered a non-error, an empty string is returned.
Returns TIBEMS_OK, TIBEMS_INVALID_ARG (string is null, or passing an object created in a different thread), TIBEMS_NOT_INITIALIZED (no error context for this thread)
See Also
tibemsErrorContext_GetLastErrorString on page 528