Decoding Palm OS error codes

Palm OS error codes are represented in C or C++ as the type Err, which is a typedef for a 16 bit unsigned integer (UInt16). Generally, the high byte is an error class (as listed in ErrorBase.h), which shows the OS manager that generated the error, while the low byte is a sequence number which distinguishes different error codes within a class.

Each error code returned by the operating system has a symbolic name defined in one or another of the SDK header files. For example, the error name corresponding to the code 0x0219 can be found by hand as follows:

  1. Look up 0x0200 in ErrorBase.h to see that this is a dmErrorClass error, i.e., a Data Manager-related error.
  2. Guess therefore that it is probably defined in DataMgr.h.
  3. Look for "dmErrorClass | 25" (25 being equal to 0x19) in DataMgr.h, and find that this is a dmErrAlreadyExists error.

This is a tedious process! A much simpler alternative is to type "219" into the text field below.

Online error decoder

Enter some error codes, separated by spaces and/or commas:

Hexadecimal only
(By default, you can enter error codes in decimal or hexadecimal -- either with or without a leading "0x" -- and the program will guess which radix was intended. Use this option to have the numbers entered always interpreted as hexadecimal.)

Palm OS decoder application and system function

ErrorCodes is a Palm OS application which acts similarly to the form above, displaying the symbolic names corresponding to the error codes entered. It is free software licensed under the GNU General Public License, and its source code can be found in the sample code collection.

Even better would be a function similar to C's strerror() which could be called from your own Palm OS applications to convert error codes to human-readable text to be displayed. In fact, there is such a function: SysErrString() has been available since Palm OS 2.0. Unfortunately, it's not particularly useful for developers:

The "Override SysErrStrings" preference causes ErrorCodes to override the system's error string tables with its own data. Use this to have calls to SysErrString() in all applications return (most of) the information displayed by ErrorCodes.

(Specifically, turning this on creates a new database containing the relevant resources and leaves it open. ErrorCodes will reopen this database at reset time if necessary. It is only opened in the UIAppShell task -- in the unlikely event that you want to use this from a background task, you will need to open the database there yourself. Its name is "ErrorCodes SysErrString data" and it is the only database with type SESd and creator ErrC.)


Back to prc-tools homepage