Defines | Functions

error.cc File Reference

Error inspection functions for Dballe. More...

#include <dballe/core/error.h>
#include <f77.h>
#include <stdint.h>
#include "handles.h"

Defines

#define MAX_CALLBACKS   50
#define CBDATA   (FDBA_HANDLE(errcb, *handle))

Functions

integer idba_error_code ()
 Return the error code for the last error that happened.
subroutine idba_error_message (character message)
 Return the error message for the last error that happened.
subroutine idba_error_context (character message)
 Return a string describing the context in which the error happened.
subroutine idba_error_details (character message)
 Return a string with additional details about the error.
void fdba_error_callback_invoker (void *data)
integer idba_error_set_callback (integer code, SUBROUTINE(func), integer data, integer handle)
 Set a callback to be invoked when an error of a specific kind happens.
integer idba_error_remove_callback (integer handle)
 Remove a callback set previously.
integer idba_default_error_handler (integer debug)
 Default callback that prints a message and exits.
integer idba_default_error_handle (integer debug)
integer idba_error_handle_tolerating_overflows (integer debug)
 Default callback that prints a message and exists, except in case of overflows.

Detailed Description

Error inspection functions for Dballe.

These funtions closely wrap the Dballe functions in dba_error.h


Function Documentation

integer idba_default_error_handler ( integer  debug )

Default callback that prints a message and exits.

The message is printed only if a non-zero value is supplied as user data

integer idba_error_code (  )

Return the error code for the last error that happened.

See dba_error_code()

Returns:
The error code. Please see the documentation of dba_err_code for the possible values.
subroutine idba_error_context ( character  message )

Return a string describing the context in which the error happened.

This string describes what the code that failed was trying to do.

See dba_error_context()

Parameters:
messageThe string holding the error context. If the string is not long enough, it will be truncated.
subroutine idba_error_details ( character  message )

Return a string with additional details about the error.

This string contains additional details about the error in case the code was able to get extra informations about it, for example by querying the error functions of an underlying module.

See dba_error_details()

Parameters:
messageThe string holding the error details. If the string is not long enough, it will be truncated.
integer idba_error_handle_tolerating_overflows ( integer  debug )

Default callback that prints a message and exists, except in case of overflows.

In case of overflows it prints a warning and continues execution

subroutine idba_error_message ( character  message )

Return the error message for the last error that happened.

The error message is just a description of the error code. To see more details of the specific condition that caused the error, use fdba_error_context() and fdba_error_details()

See dba_error_message()

Parameters:
messageThe string holding the error messag. If the string is not long enough, it will be truncated.
integer idba_error_remove_callback ( integer  handle )

Remove a callback set previously.

Parameters:
handleThe handle previously returned by idba_error_set_callback
Returns:
The error indicator for the function
integer idba_error_set_callback ( integer  code,
SUBROUTINE(func)  ,
integer  data,
integer  handle 
)

Set a callback to be invoked when an error of a specific kind happens.

Parameters:
codeThe error code (See dba_err_code) of the error that triggers this callback. If DBA_ERR_NONE is used, then the callback is invoked on all errors.
funcThe function to be called.
dataAn arbitrary integer data that is passed verbatim to the callback function when invoked.
Return values:
handleA handle that can be used to remove the callback
Returns:
The error indicator for the function