Exodus 7.10

Macros | Functions | Variables
ex_err.c File Reference
`#include "exodusII.h"`
`#include "exodusII_int.h"`
`#include "netcdf.h"`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`

## Macros
#define | EX_PNAME last_pname
#define | EX_ERRMSG last_errmsg
#define | EX_ERR_NUM last_err_num

## Functions
void | ex_reset_error_status ()
void | ex_err (const char *module_name, const char *message, int err_num)
void | ex_set_err (const char *module_name, const char *message, int err_num)
void | ex_get_err (const char **msg, const char **func, int *err_num)
const char * | ex_strerror (int err_num)

## Variables
int | exerrval = 0
static char | last_pname [MAX_ERR_LENGTH]
static char | last_errmsg [MAX_ERR_LENGTH]
static int | last_err_num

## Macro Definition Documentation

## ◆ EX_ERR_NUM

#define EX_ERR_NUM last_err_num

## ◆ EX_ERRMSG

#define EX_ERRMSG last_errmsg

## ◆ EX_PNAME

#define EX_PNAME last_pname

## Function Documentation

## ◆ ex_err()

void ex_err | ( | const char * | module_name,
|  | const char * | message,
|  | int | err_num
| ) |  |

The function ex_err() logs an error to stderr. It is intended to provide explanatory messages for error codes returned from other exodus routines.

The passed in error codes and corresponding messages are listed in ???. The programmer may supplement the error message printed for standard errors by providing an error message. If the error code is provided with no error message, the predefined message will be used. The error code EX_MSG is available to log application specific messages.

Parameters

  [in] | module_name | This is a string containing the name of the calling function.
  [in] | message | This is a string containing a message explaining the error or problem. If EX_VERBOSE (see ex_opts()) is true, this message will be printed to stderr. Otherwise, nothing will be printed. Maximum length is `MAX_ERR_LENGTH`.
  [in] | err_num | This is an integer code identifying the error. exodus C functions place an error code value in exerrval, an external int. Negative values are considered fatal errors while positive values are warnings. There is a set of predefined values defined in `exodusII.h`. The predefined constant `EX_PRTLASTMSG` will cause the last error message to be output, regardless of the setting of the error reporting level (see ex_opts()).

The following is an example of the use of this function:

int exoid, CPU_word_size, IO_word_size, errval;
float version;
char errmsg[MAX_ERR_LENGTH];
CPU_word_size = sizeof(float);
IO_word_size = 0;
/* open exodus file */
if (exoid = ex_open ("test.exo", EX_READ, &CPU_word_size,
&IO_word_size, &version)) {
errval = 999;
snprintf(errmsg, MAX_ERR_LENGTH,"ERROR: cannot open file test.exo");
ex_err(__func__, errmsg, errval);
}

## ◆ ex_get_err()

void ex_get_err | ( | const char ** | msg,
|  | const char ** | func,
|  | int * | err_num
| ) |  |

## ◆ ex_reset_error_status()

void ex_reset_error_status | ( |  | ) |

## ◆ ex_set_err()

void ex_set_err | ( | const char * | module_name,
|  | const char * | message,
|  | int | err_num
| ) |  |

## ◆ ex_strerror()

const char* ex_strerror | ( | int | err_num | ) |

## Variable Documentation

## ◆ exerrval

int exerrval = 0

shared error return value

## ◆ last_err_num

int last_err_num
| static

## ◆ last_errmsg

char last_errmsg[MAX_ERR_LENGTH]
| static

## ◆ last_pname

char last_pname[MAX_ERR_LENGTH]
| static