| igraph Reference Manual |
|---|
The contents of the rest of this chapter might be useful only for those who want to create an interface to igraph from another language. Most readers can safely skip to the next chapter.
You can write and install error handlers simply by defining a
function of type igraph_error_handler_t and calling
igraph_set_error_handler(). This feature is useful for interface
writers, as igraph will have the chance to
signal errors the appropriate way, eg. the R interface defines an
error handler which calls the error()
function, as required by R, while the Python interface has an error
handler which raises an exception according to the Python way.
If you want to write an error handler, your error handler should
call IGRAPH_FINALLY_FREE() to deallocate all temporary memory to
prevent memory leaks.
igraph_error_handler_t* igraph_set_error_handler(igraph_error_handler_t* new_handler);
Installs a new error handler. If called with 0, it installs the
default error handler (which is currently
igraph_error_handler_abort).
Arguments:
new_handler: |
The error handler function to install. |
Returns:
|
The old error handler function. This should be saved and
restored if |
| << 4. Advanced topics | 4.2. Error handling internals >> |