mco_error_set_handler

Register a fatal error handler.

Prototype

    void mco_error_set_handler( /*IN*/ mco_error_handler_f func);

Arguments

func
The name of the function in your application that will be called by the runtime to handle fatal error conditions.

Description

This function registers an application function to handle fatal error conditions. It is called from the runtime's function mco_stop(), which is called whenever an unrecoverable error is encountered (with return codes MCO_ERR_*). Accordingly, your error handling function will accept a single int argument, which is the eXtremeDB error code (MCO_ERR_*) value that caused the error handler to be invoked. If an error handler is not registered, mco_stop() will enter an infinite loop.

Return Codes

void
No return value.

Example

    Application snippet:

    const char * dbname = "SimpleDb";

    static void errhandler( MCO_RET errcode)
    {
        printf( "\n eXtremeDB runtime fatal error: %d\n", errcode );
        getchar();
        exit( -1 );
    }

    int main(int argc, char* argv[])
    {
        mco_db_h db;
        MCO_RET rc;
        mco_device_t       dev;
        mco_db_params_t    db_params;
        ...
        mco_error_set_handler( &errhandler );

        if( (rc = mco_runtime_start()) != MCO_S_OK)
            exit(-1);
    }

Files

Header file:
mco.h
Source file:
mcoerr.c
Library:
libmcounrt.a
Header file:
mco.h
Source file:
mcoerr.c
Library:
libmcounrt.a