Next Previous Contents

7. _clear_error


Clear an error condition


_clear_error ()


This function may be used in error-blocks to clear the error that triggered execution of the error block. Execution resumes following the statement, in the scope of the error-block, that triggered the error.


Consider the following wrapper around the putenv function:

    define try_putenv (name, value)
       variable status;
          _clear_error ();
          status = -1;
       status = 0;
       putenv (sprintf ("%s=%s", name, value);
       return status;
If putenv fails, it generates an error condition, which the try_putenv function catches and clears. Thus try_putenv is a function that returns -1 upon failure and 0 upon success.
See Also

_trace_function, _slangtrace, _traceback

Next Previous Contents