Important: The information in this document is obsolete and should not be used for new development.
ResErrorAfter calling a Resource Manager routine, you can use the
ResErrorfunction to determine whether an error occurred and, if so, what it was.
FUNCTION ResError: Integer;
ResErrorfunction reads the value stored in the system global variable
ResErrand returns an integer result code identifying errors, if any, that occurred. If no error occurred,
noErr. If an error occurs at the Resource Manager level,
ResErrorreturns one of the integer result codes listed in this section. If an error occurs at the Operating System level,
ResErrorreturns an Operating System result code, such as the Memory Manager error
memFullError the File Manager error
Resource Manager procedures do not report error information directly. Instead, after calling a Resource Manager procedure, your application should call the
ResErrorfunction to determine whether an error occurred.
Resource Manager functions usually return
NILor -1 as the function result when there's an error. For Resource Manager functions that return -1, your application can call the
ResErrorfunction to determine the specific error that occurred. For Resource Manager functions that return handles, your application should always check whether the value of the returned handle is
NIL. If it is, your application can use
ResErrorto obtain specific information about the nature of the error. Note, however, that in some cases
noErreven though the value of the returned handle is
Only those result codes dealing specifically with resources are listed in this section. See the description of each Resource Manager routine for a list of errors specific to that routine and that the
- In certain cases, the
noErreven though a Resource Manager routine was unable to perform the requested operation. See the individual routine descriptions for details about the circumstances under which this happens.
ASSEMBLY-LANGUAGE INFORMATIONThe global variable
ResErrstores the current value of
ResError, that is, the result code of the most recently performed Resource Manager operation. In addition, you can specify an application-defined procedure to be called whenever an error occurs. To do this, store the address of the procedure in the global variable
ResErrProc. The value of the
ResErrProcglobal variable is usually 0. Before returning a result code other than
ResErrorfunction puts that result in register D0 and calls the procedure identified by the
If you use
ResErrProcto detect resource errors, you will get unexpected calls to your application-defined procedure if you call
GetMenu. The Menu Manager routine
GetMenumakes a call to
GetResInfo, requesting resource information about
MDEF' 0. Unfortunately, because
ROMMapInsertis set to
FALSE, this call fails, setting
ResErrto -192 (
resNotFound). This, in turn, causes a call to your application-defined procedure, even though the
GetMenuroutine has worked correctly.
To avoid this problem, follow these steps when you call
GetMenuif you are using
- Save the address of your application-defined procedure.
GetResourcefor the menu resource you want to get.
- Check whether
GetResourcereturns a handle whose value is
NIL; if so, process the error in whatever way is appropriate for your application.
- When you are finished calling
GetMenu, restore the previous value of
noErr 0 No error resNotFound -192 Resource not found resFNotFound -193 Resource file not found addResFailed -194
resAttrErr -198 Attribute inconsistent with operation mapReadErr -199 Map inconsistent with operation