> 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.

> Function | Description | Page
> tibemsErrorContext_Create | Create a new error context object. | 522
> tibemsErrorContext_Close | Close and free memory associated with an error context. | 523
> tibemsErrorContext_GetLastErrorString | Retrieve any available detailed error string associated with the last EMS call. | 524
> tibemsErrorContext_GetLastErrorStackTrace | Retrieve a stack trace associated with the last EMS call. | 525

> 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

> Parameter | Description
> errorContext | The function stores the new error context in this location.

> 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 523
> 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

> Parameter | Description
> errorContext | Close this error context.

> Remarks
> Returns TIBEMS_OK, TIBEMS_INVALID_ARG.
> See Also
> tibemsErrorContext_Create on page 522
> 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

> Parameter | Description
> errorContext | The error context.
> string | Location of the detailed error string.

> 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 525
> 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

> Parameter | Description
> errorContext | The error context.
> string | Location of the stack trace string.

> 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 524

Copyright © TIBCO Software Inc. All Rights Reserved.