# Error Handler Extended

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_ex()`, `mco_stop()` will in turn call the application extended error handler function which must have the following signature:

        typedef void(*mco_error_handler_f_ex)(MCO_RET errcode, const char* file, int line);

The parameter errcode is the code of the fatal error, file is the name of the source file and line is the line number in the source file.

Following is an example of an extended error handler implementation:

        static void extended_errhandler(MCO_RET errcode, const char* file, int line)
        {
            printf("\n eXtremeDB fatal error: %d on line %d of file %s", errcode, line, file);
            getchar();
            exit( -1 );
        }