(Page 7 of 9 in this chapter)
3.6 CT Access Error Codes
- All CT Access functions return a status code. A SUCCESS (0) return code indicates that either the function completed (synchronous functions) or that the function was initiated (asychronous functions).
- If the return code is not SUCCESS, it is an error code and the function has failed. Asynchronous functions that return a non-zero value are never initiated; therefore, no subsequent events will be generated.
- If an asynchronous function fails after being initiated, CT Access delivers a DONE event to the application and the event value field contains an error code.
- Error codes are defined by each service. All services providing the same functionality provide consistent error codes. ctaGetText can be used to obtain the text representation of an error code.
- CT Access system error codes are defined in the header file ctaerr.h and are prefixed with CTAERR_. Service error codes are defined in their respective header files (e.g., vcedef.h for Voice Message service error codes). Error codes are also defined in the CT Access Function Reference Manual. The ADI service error codes are defined in the ADI Service Function Reference Manual.
3.6.1 Handling Errors
- ctaSetErrorHandler is used to define an action if an error occurs. If an error is encountered when executing any CT Access function, CT Access performs the error action before returning to the application. The error action is undertaken only when CT Access functions are invoked; it is not undertaken if an error is returned via an event.
- By default, there is no error action. You can specify the following error actions:
- Print an error message and exit CT Access
- Call a user-defined error handler
3.6.2 Error Tracing
- Tracing is enabled and disabled in the call to ctaInitialize. Both services and the application can log trace messages.
- Service tracing is enabled by calling ctaSetTraceLevel. In the call to ctaSetTraceLevel, you set a flag to indicate what to trace (e.g., events, commands, etc.). Based on the flags set, the service will log internal trace information to the CT Access daemon (ctdaemon).
- ctaLogTrace is used by the application to log application trace messages. A trace severity and a format is passed with the trace value.
- If tracing is enabled, the CT Access daemon (ctdaemon) must be running. Using the daemon, you can specify to send trace messages to a file or to a terminal in interactive mode.
- The ctdaemon utility allows you to log trace messages to a file. Refer to Section 13.3.3, CT Access Daemon: ctdaemon for more information.
(Page 7 of 9 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.