RWBROOK interface functions: Error Handling and Return Codes.
Almost every RWBROOK interface function returns a code reporting on the success of the operation. Successful operation always returns RWBERR_Ok=0. An application may check the return code and branch the execution according to that.
In RWBROOK, serious problems are assigned negative return codes (error codes). A negative return generally (but not necessarily) implies that application may want to stop. In any event it means that a RWBROOK function, which returned such a code, has aborted its execution somewhere in the middle and the operation was not completed.
Less serious issues are referred to as warnings. Warning return codes are always positive and encoded as bits. One return may contain several warnings. Warnings generally do not suggest application to stop, and any RWBROOK function, which returned warning(s) guarantees that its execution was completed properly (at least from the point of system safety and stability).
RWBROOK interface provides two functions which automate the process of checking the return codes. These functions will suffice for most cases, so that there is no need to program error checker after each RWBROOK call and moreover, there is no need to go through all return codes.
The RWBROOK error checkers are:
Full list of RWBROOK return codes:
subroutine RBErrStop ( iPlace,iRet,iUnit,iStop )
If there were no errors (iRet=RWBERR_Ok),
the function does nothing.
PARAMETERS:
and execution continues.
Example:
subroutine RBCheckErr ( iPlace,iStop )
Represents a simplified call to
RBErrStop. It will work correctly only
if called immediately after an RWBROOK function. The meaning of
parameters is exactly the same as for same-name parameters of
RBErrStop.
Example:
RWBROOK Error Codes
The RWBROOK Error Codes are encoded in
mmdb_rwbrook.h . They are not likely
to change in the future, but nevertheless it is advisable for
C and C++ programmers to use them by their names given below.
FORTRAN developers are not given a chance other then to hardcode
their numerical values.
*** RWBROOK error: point code unit function
*** 12 -3 3 XYZOpen
*** file : input.pdb
*** reason : cannot open a file
*** Execution stopped.
NOTE: RBErrStop will display
the name of RWBROOK function encountered the problem
(XYZOpen above) correctly if
only called immediately after it.
*** RWBROOK error: point code unit function
*** 12 -3 3 XYZOpen
*** file : input.pdb
*** reason : cannot open a file
*** continue running, may crash ...
call XYZOpen ( FName,RWStat,FType,iUnit,iRet )
call RBErrStop ( 12,iRet,iUnit,0 )
call XYZOpen ( FName,RWStat,FType,iUnit,iFail )
call RBCheckErr ( 12,0 )