grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

error.c File Reference

DBMI Library (base) - error management. More...

#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
Include dependency graph for error.c:

Go to the source code of this file.


void db_on_error (void(*f)(const char *))
 User defined error procedure. More...
void db_set_error_who (const char *me)
 Set 'who' for error messages. More...
const char * db_get_error_who (void)
void db_error (const char *s)
 Report error message. More...
void db_protocol_error (void)
 Report protocol error. More...
void db_syserror (const char *s)
 Report system error. More...
int db_get_error_code (void)
 Get error code. More...
void db_memory_error (void)
 Report memory error. More...
void db_procedure_not_implemented (const char *name)
 Report 'not implemented' error. More...
void db_noproc_error (int procnum)
 Report no procedure error. More...
void db_clear_error (void)
 Clear error status. More...
void db_print_error (void)
 Print error. More...
void db_debug_on (void)
 Turn on debugging. More...
void db_debug_off (void)
 Turn off debugging. More...
void db_debug (const char *s)
 Print debug message. More...
const char * db_get_error_msg (void)
 Get error message. More...
void db_auto_print_errors (int flag)
 Toggles printing of DBMI error messages. More...
void db_auto_print_protocol_errors (int flag)
 Set auto print protocol error. More...


static int err_flag = 0
static int err_code = DB_OK
static char * err_msg = 0
static int auto_print_errors = 1
static int auto_print_protocol_errors = 1
static void(* user_print_function )(const char *)
static char * who = NULL
static int debug_on = 0

Detailed Description

DBMI Library (base) - error management.

(C) 1999-2011 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Joel Jones (CERL/UIUC)
Upgraded to GRASS 5.7 by Radim Blazek
Doxygenized by Martin Landa <landa.martin> (2011)

Definition in file error.c.

Function Documentation

◆ db_auto_print_errors()

void db_auto_print_errors ( int  flag)

Toggles printing of DBMI error messages.


Definition at line 249 of file error.c.

References auto_print_errors, and auto_print_protocol_errors.

Referenced by db_driver(), and read_dblinks_ogr().

◆ db_auto_print_protocol_errors()

void db_auto_print_protocol_errors ( int  flag)

Set auto print protocol error.


Definition at line 260 of file error.c.

References auto_print_protocol_errors.

Referenced by db_driver().

◆ db_clear_error()

void db_clear_error ( void  )

Clear error status.

Definition at line 171 of file error.c.

References DB_OK, err_code, and err_flag.

Referenced by db_dirent(), and db_driver().

◆ db_debug()

void db_debug ( const char *  s)

Print debug message.

sdebug message

Definition at line 228 of file error.c.

References debug_on, s, and who.

◆ db_debug_off()

void db_debug_off ( void  )

Turn off debugging.

Definition at line 218 of file error.c.

References debug_on.

◆ db_debug_on()

void db_debug_on ( void  )

Turn on debugging.

Definition at line 210 of file error.c.

References debug_on.

◆ db_error()

◆ db_get_error_code()

◆ db_get_error_msg()

const char * db_get_error_msg ( void  )

Get error message.

pointer to error message string

Definition at line 239 of file error.c.

References err_flag, err_msg, and NULL.

Referenced by db__send_failure().

◆ db_get_error_who()

const char * db_get_error_who ( void  )

brief Get 'who' string

pointer to string buffer
empty buffer if 'who' is not defined

Definition at line 59 of file error.c.

References who.

◆ db_memory_error()

void db_memory_error ( void  )

Report memory error.

Definition at line 134 of file error.c.

References _, db_error(), DB_MEMORY_ERR, and err_code.

Referenced by db_calloc(), db_malloc(), and db_realloc().

◆ db_noproc_error()

void db_noproc_error ( int  procnum)

Report no procedure error.

procnumprocedure number

Definition at line 159 of file error.c.

References _, db_error(), DB_NOPROC, err_code, and procnum.

Referenced by db__start_procedure_call().

◆ db_on_error()

void db_on_error ( void(*)(const char *)  f)

User defined error procedure.

fpointer to user-defined function

Definition at line 36 of file error.c.

References user_print_function.

◆ db_print_error()

void db_print_error ( void  )

Print error.

If not defined, the error message is printed to stderr.

Definition at line 183 of file error.c.

References err_flag, err_msg, user_print_function, and who.

Referenced by db_error().

◆ db_procedure_not_implemented()

◆ db_protocol_error()

◆ db_set_error_who()

void db_set_error_who ( const char *  me)

Set 'who' for error messages.

memy name

Definition at line 46 of file error.c.

References db_free(), db_store(), and who.

◆ db_syserror()

void db_syserror ( const char *  s)

Report system error.

serror message

Definition at line 101 of file error.c.

References db_error(), err_flag, s, and who.

Referenced by db_dirent(), db_driver(), db_read_dbmscap(), db_start_driver(), and make_dir().

Variable Documentation

◆ auto_print_errors

int auto_print_errors = 1

Definition at line 25 of file error.c.

Referenced by db_auto_print_errors(), db_error(), and db_protocol_error().

◆ auto_print_protocol_errors

int auto_print_protocol_errors = 1

Definition at line 26 of file error.c.

Referenced by db_auto_print_errors(), db_auto_print_protocol_errors(), and db_protocol_error().

◆ debug_on

int debug_on = 0

Definition at line 205 of file error.c.

Referenced by db_debug(), db_debug_off(), and db_debug_on().

◆ err_code

◆ err_flag

int err_flag = 0

◆ err_msg

char* err_msg = 0

Definition at line 24 of file error.c.

Referenced by db_error(), db_get_error_msg(), and db_print_error().

◆ user_print_function

void(* user_print_function) (const char *) ( const char *  )

Definition at line 27 of file error.c.

Referenced by db_on_error(), and db_print_error().

◆ who

char* who = NULL

Definition at line 29 of file error.c.

Referenced by db_debug(), db_get_error_who(), db_print_error(), db_set_error_who(), and db_syserror().