Macintosh Development |
[Home]
[About Us]
[People]
[Information Systems]
[Kerberos for Macintosh]
[Applications]
[Miscellaneous Documentation]
ErrorLib API Functions |
OSStatus
GetMITLibError (
void );
void
SetMITLibError (
OSStatus theError );
void
ClearMITLibError (
void );
GetMITLibError()
gets the current Kerberos Support Library error code. Clients should call this after calling MIT Support Library functions to check what error occurred. Some Kerberos Support Library functions do not set the error unless they report failure (for instance, you only need to callGetMITLibError()
ifsocket()
returns-1
.
SetMITLibError()
sets the current Kerberos Support Library error code. Only libraries needing to return errors back to client applications should call this function.
ClearMITLibError()
sets the current Kerberos Support Library error code back tonoErr
. Libraries using ErrorLib to return errors to callers should call this at the beginning of every API function.
OSStatus
RegisterErrorTable (
const FSSpec* inResFile,
SInt16 inResID );OSStatus
RegisterErrorTableForBundle (
CFStringRef inBundleID,
SInt16 inResID );
RegisterErrorTable()
(Mac OS 8 and 9) andRegisterErrorTableForBundle()
(Mac OS X) add new error to description string mappings to ErrorLib's error tables. When callingRegisterErrorTable()
,inResFile
is the resource file to get the error tables from. When callingRegisterErrorTableForBundle()
,inBundleID
is the bundle identifier for the framework whose resource fork contains the error tables (usually the caller's bundle identifier).inResID
is the resource ID of the error table resource.Error tables are of resource type
'ErrT'
. The resource template is defined in ErrorList.r. The short string is the name of the error (eg:ENOMEM
) and the long string is a description of the error (eg: "Out of memory").The ErrorLib implementations of
RegisterErrorTable()
andRegisterErrorTableForBundle()
only saveinResFile
andinResID
orinBundleID
. The error tables will not actually get loaded until one of the error string functions described below is called. This is because if ErrorLib loaded all the Str255 error strings all the time, Kerberos Support Library would have a massive memory footprint and could not be called by code resources or applications short on memory. However, ErrorLib does keep the error strings for Resource Manager and Memory Manager errors loaded so that if the error table loading code fails it can generate an appropriate "Out of memory" error.
OSStatus
GetErrorString (
OSStatus error,
char *message,
long messageLength,
ErrorFormat format );OSStatus
GetErrorLongFormat (
OSStatus error,
char *message,
long messageLength );OSStatus
GetErrorShortFormat (
OSStatus error,
char *message,
long messageLength );OSStatus
GetErrorManager (
OSStatus error,
char *message,
long messageLength );OSStatus
GetErrorLongString (
OSStatus error,
char *message,
long messageLength );OSStatus
GetErrorShortString (
OSStatus error,
char *message,
long messageLength );
GetErrorString()
loads the error string for the error specified byerror
and places the string inmessage
.messageLength
is the size of the buffer allocated formessage
(GetErrorString()
will not overrun the buffer).format
is the format type you want the error string to be in. Possible values forformat
are:
kErrorLongFormat
:Returns a string of the form
"[Manager Name] returned [Short String] ([Error Code]: [Long string]."
(eg:"Open Transport returned kOTNoDataErr (-3162): No data available for reading."
)kErrorShortFormat
:Returns a string of the form
"[Manager Name]: [Short String] ([Error Code])"
(eg:"Open Transport: kOTNoDataErr (-3162)"
)kErrorManager
:Returns the Manager Name kErrorLongString
:Returns the Short String for the error. kErrorShortString
:Returns the Long String for the error.
GetErrorLongFormat()
is equivalent toGetErrorString()
called withkErrorLongFormat
as the format.
GetErrorShortFormat()
is equivalent toGetErrorString()
called withkErrorShortFormat
as the format.
GetErrorManager()
is equivalent toGetErrorString()
called withkErrorManager
as the format.
GetErrorLongString()
is equivalent toGetErrorString()
called withkErrorLongString
as the format.
GetErrorShortString()
is equivalent toGetErrorString()
called withkErrorShortString
as the format.
Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:49:33 $
Last modified by $Author: smcguire $