ASetErrorHandler(3X)
NAME
ASetErrorHandler − replace default error handler with specified handler
SYNOPSIS
#include <Alib.h> AErrorHandler
ASetErrorHandler (
AErrorHandler handler );
DESCRIPTION
ASetErrorHandler() replaces the default error handler with the handler specified in handler, and returns a pointer to the handler that was previously in effect.
handler is the pointer to an application-supplied handler function.
The error handler gets called when both of the following statements are true:
−
an Audio Library error occurs inside an Audio Library routine
−
the application program has not supplied a status return parameter for the routine
The new error handler should return AENoError, if the error should be ignored. If the error should not be ignored and the handler cannot correct it, the handler should return the error code. The handler should take two arguments as illustrated below.
RETURN VALUE
Upon successful completion, ASetErrorHandler() returns a pointer to the handler that was previously in effect.
ERRORS
ASetErrorHandler() does not return an error status.
EXAMPLE
The following example replaces the default error handler with a handler named myhandler.
long myhandler(
Audio ∗ audio,
AErrorEvent ∗ err_event
)
{
char errorbuff[132];
AGetErrorText(audio, err_event->error_code, errorbuff, 131);
printf ("Error is %s\n", errorbuff);
return (err_event->error_code);
}
.
.
.
AErrorHandler prev_handler; /∗ ptr to previous handler ∗/
.
.
.
/∗ replace default error handler ∗/
prev_handler = ASetErrorHandler(myhandler);
NOTE
In order to ensure that the compiler finds the Audio Library (libAlib.sl) and the Alib.h header file, you must add the following switches:
-L /opt/audio/lib
-I/opt/audio/include
DEPENDENCIES
This function belongs to the Audio Library of functions that manage connections to an audio server. The audio server must run on a system that has audio hardware. To find out whether or not your system has audio hardware, refer to Using the Audio Developer’s Kit or the online help for the Audio control panel. For information about the audio capabilities of a particular system use the online example audioinfo.c.
AUTHOR
ASetErrorHandler() was developed by HP.
SEE ALSO
ASetIOErrorHandler(3X), AGetErrorText(3X).
Hewlett-Packard Company — Audio Library: February, 1995