DL Logo

ASException Typedefs

ASErrSeverity

Header: ASExpT.h:292

Syntax

typedef ASEnum8 ASErrSeverity;

Used By

ASErrorCode

Header: ASExpT.h:111

Description

An error code value for use in ASFile and ASFileSys methods and callbacks.

Syntax

typedef ASInt32 ASErrorCode;

Returned From

Used By

Used In

ASException Callback Signatures

restoreEnvironProc

Header: CoreExpT.h:210

Description

Environment-restoration functions are called when an exception is raised.

Syntax

void restoreEnvironProc(void *asEnviron);

Parameters

asEnviron
The environment to restore.

ASException Functions

ASGetErrorString

Header: ASProcs.h:137

Description

Gets a string describing the specified error/exception.

Syntax

const char *ASGetErrorString(ASErrorCode errorCode, char *buffer, ASTArraySize lenBuffer);

Parameters

errorCode
The exception whose error string is obtained. This must be a full error code, built with the ErrBuildCode() macro or a user-defined exception returned from ASRegisterErrorString(). See Errors for a list of predefined exceptions.
buffer
(Filled by the method) A buffer into which the string is written. Make sure to memset the buffer to 0 before calling ASGetErrorString().
lenBuffer
The number of characters that buffer can hold.

Returns

A useful pointer to buffer. This does not mean that the function worked. You must call strlen on the returned buffer (as long as you memset the buffer to 0) to determine whether the error code was valid.

ASGetErrorStringASText

Header: ASProcs.h:2820

Description

Gets an ASText object containing a string describing the specified exception.

Syntax

void ASGetErrorStringASText(ASErrorCode errorCode, ASText errorString);

Parameters

errorCode
The exception whose error string is obtained. This must be a full error code, built with the ErrBuildCode macro or a user-defined exception returned from ASRegisterErrorString(). See Error Systems for a list of predefined exceptions.
errorString
(Filled by the method) The text object containing the error string. The client must pass a valid ASText object. The routine does not allocate it.

ASGetExceptionErrorCode

Header: CorProcs.h:90

Description

Gets the error code for the most recently raised exception. See Error Systems for a list of predefined exceptions.

Syntax

ASErrorCode ASGetExceptionErrorCode(void);

Returns

Exception error code.

ASPopExceptionFrame

Header: CorProcs.h:78

Description

Pops an exception frame off the stack.

Note: You will probably never call ASPopExceptionFrame() directly; it is called for you as appropriate from within the HANDLER, E_RETURN and E_RTRN_VOID macros.

Syntax

void ASPopExceptionFrame(void);

ASPushExceptionFrame

Header: CorProcs.h:68

Description

Pushes an exception frame buffer and a frame-restoration callback onto the stack. The restoreFunc should be a function matching the following prototype.

Note: You will probably never call ASPushExceptionFrame() directly; use the DURING macro instead.

Syntax

void ASPushExceptionFrame(void *asEnviron, ACRestoreEnvironProc restoreFunc);

Parameters

asEnviron
IN/OUT Represents a stack environment that is restored if an exception occurs. On Windows and Mac OS, this is a jmp_buf, which is an array of integers.
restoreFunc
IN/OUT Should be a function matching the following prototype: ACCB1 void ACCB2 RestorePlugInFrame( void * asEnviron)

ASRaise

Header: CorProcs.h:50

Description

Raises an exception. Plug-ins can raise any exception defined in the AcroErr.h header file using the ErrBuildCode macro, or can define their own exceptions using ASRegisterErrorString(). See Errors for a list of predefined exceptions.

If the code that calls ASRaise() gets control as a result of a non-Acrobat event (such as a drag and drop event on some platforms), this method fails since there is no Acrobat viewer code in the stack to handle the exception.

Syntax

void ASRaise(ASErrorCode error);

Parameters

error
An error code for the exception to raise. Error codes have three parts: severity, system, and error number. Use ErrBuildCode to build an error code for an existing error.

ASRegisterErrorString

Header: ASProcs.h:171

Description

Registers a new error and string. The error can be used to raise a plug-in-specific exception using ASRaise(). When the exception is raised, its error string can be retrieved using ASGetErrorString() and reported to the user using AVAlertNote().

The error system is automatically forced to be ErrSysXtn. (See the list of Error Systems).

The error is automatically assigned an error code that is not used by any other plug-in (in the current implementation, the Acrobat viewer increments a counter each time any plug-in requests an error code, and returns the value of the counter). As a result, plug-ins cannot rely on being assigned the same error code each time the Acrobat viewer is launched.

Related Methods

ASGetErrorString ASRaise

Syntax

ASErrorCode ASRegisterErrorString(ASErrSeverity severity, const char *errorString);

Parameters

severity
The severity of the error being defined. It must be one of the Severities.
errorString
The string describing the exception. This string is used by ASGetErrorString(), and is copied by ASRegisterErrorString(); it may be freed by the plug-in after registering the error.

Returns

The newly created error code. Plug-ins should assign the error code returned by this method to a variable if they will use the error code later in the current session.

ASRegisterErrorStringASText

Header: ASProcs.h:2839

Description

Registers a new error and string.

Syntax

ASErrorCode ASRegisterErrorStringASText(ASErrSeverity severity, const ASText errorString);

Parameters

severity
The severity of the error being defined. It must be one of the Error Severities.
errorString
The text object containing the error string to be set.

Returns

The newly created error code. Plug-ins should assign the error code returned by this method to a variable if they wish to use the error code later in the current session.