Throwing Your Own Errors - Texas Instruments TI-89 Developer's Manual

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

96
CM_INIT, or CM_MODE_CHANGE. If your app hits an error condition while
processing one of these events, it should store an explanatory error code
number in EV_errorCode, then return to the OS. The OS will then display the
error message dialog box.
It is best to steer clear of signaling error messages while processing these
events. If, however, you cannot avoid exceptions, keep in mind that
EV_errorCode can hold only a single error code. If your app stores to
EV_errorCode multiple times before returning to the OS, only the last error code
will be displayed in an error dialog box.
10.3.

Throwing Your Own Errors

Your application may have exceptional conditions which are not properly
described by any of the built-in error messages. Error numbers beginning at
OO_FIRST_APP_STRING (0x800 – 0xEFF) are available for application-specific
errors. Whenever your code throws an error number in this range, the system
error handler looks for the text of the error message in the current application.
Place the text of your error messages in the frame of your application beginning
with attribute OO_FIRST_STRING. Then, if your app throws error number
OO_FIRST_APP_STRING + 1, for example, then the system error handler will
display the text of string OO_FIRST_STRING + OO_FIRST_APP_STRING + 1.
See section 7.3.1.1. FRAME for a discussion of how to lay out an application
frame and where to put your strings in the frame.
Sometimes your application is not the current app. If you use ER_throwVar to
throw an application error when another application is the current app, the
system error handler will look for the text of the error message in the other app.
This can happen when another app calls routines in your shared-code library or
when a TI-BASIC program calls an extension function defined in your app. How
do you throw application errors if your app is not the current app?
ER_throwFrame to the rescue!
ER_throwFrame takes two arguments — the error number and a pointer to your
application frame. The system error handler looks in the given app frame for the
text of your error message. Your shared-code routines and TI-BASIC extensions
should always use ER_throwFrame to throw application errors.
Note: The second parameter to ER_throwFrame should be the variable containing your app's
TI-89 / TI-92 Plus Developer Guide
pointer to frame described in section 7.3.1.2. Pointer to FRAME. Installing a language
localizer for your app links in a new frame ahead of your app frame by updating your
pointer to frame. During a subsequent call to ER_throwFrame, the system error handler
will look first for the text of your error message in the language localizer.
Not for Distribution
Chapter 10: Error Handling
Beta Version January 26, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents