# Error Handler

When the runtime encounters an unrecoverable error it calls the internal function `mco_stop()`. If an error handler has been registered by calling `mco_error_set_handler()`, `mco_stop()` will in turn call the application error handler function which must have the following signature:

        typedef void(*mco_error_handler_f)(MCO_RET errcode);

The parameter errcode is the code of the fatal error.

Following is an example of an error handler implementation:

        static void errhandler( int n )
        {
            printf( "\neXtremeDB fatal error: %d", n );
            getchar();
            exit( -1 );
        }