Axis2/C: error

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# error
[utilities]

## Classes
struct | axutil_error
## Defines
#define | AXIS2_ERROR_FREE(error) axutil_error_free(error)
#define | AXIS2_ERROR_GET_MESSAGE(error) axutil_error_get_message(error)
#define | AXIS2_ERROR_SET_MESSAGE(error, message) axutil_error_set_error_message(error, message)
#define | AXIS2_ERROR_SET_ERROR_NUMBER(error, error_number) axutil_error_set_error_number(error, error_number)
#define | AXIS2_ERROR_SET_STATUS_CODE(error, status_code) axutil_error_set_status_code(error, status_code)
#define | AXIS2_ERROR_GET_STATUS_CODE(error) axutil_error_get_status_code(error)
## Typedefs
typedef struct axutil_error | axutil_error_t
## Functions
AXIS2_EXTERN const axis2_char_t * | axutil_error_get_message (const struct axutil_error *error)
AXIS2_EXTERN axis2_status_t | axutil_error_set_error_number (struct axutil_error *error, axutil_error_codes_t error_number)
AXIS2_EXTERN axis2_status_t | axutil_error_set_status_code (struct axutil_error *error, axis2_status_codes_t status_code)
AXIS2_EXTERN axis2_status_t | axutil_error_get_status_code (struct axutil_error *error)
AXIS2_EXTERN axis2_status_t | axutil_error_set_error_message (struct axutil_error *error, axis2_char_t *message)
AXIS2_EXTERN axis2_status_t | axutil_error_init (void)
AXIS2_EXTERN void | axutil_error_free (struct axutil_error *error)
AXIS2_EXTERN axutil_error_t * | axutil_error_create (axutil_allocator_t *allocator)

## Define Documentation

#define AXIS2_ERROR_FREE | ( | error |  | ) | axutil_error_free(error)

Deprecated:
  The following macros are no longer useful as we can use the function calls directly. Hence these macros should be removed

## Typedef Documentation

typedef struct axutil_error axutil_error_t

Axutil error struct. Error holds the last error number, the status code as well as the last error message.

## Function Documentation

AXIS2_EXTERN axutil_error_t* axutil_error_create | ( | axutil_allocator_t * | allocator | ) |

Creates an error struct

Parameters:

  | allocator | allocator to be used. Mandatory, cannot be NULL

Returns:
  pointer to the newly created error struct

AXIS2_EXTERN void axutil_error_free | ( | struct axutil_error * | error | ) |

De-allocates an error struct instance.

Parameters:

  | error | pointer to error struct instance to be freed.

Returns:
  void

AXIS2_EXTERN const axis2_char_t* axutil_error_get_message | ( | const struct axutil_error * | error | ) |

Gets the error message corresponding to the last error occurred.

Parameters:

  | error | pointer to error struct

Returns:
  string representing the error message for the last error occurred

AXIS2_EXTERN axis2_status_t axutil_error_get_status_code | ( | struct axutil_error * | error | ) |

Gets the status code.

Parameters:

  | error | pointer to error struct

Returns:
  last status code set on error struct

AXIS2_EXTERN axis2_status_t axutil_error_init | ( | void |  | ) |

Initializes the axutil_error_messages array. This array holds the error messages that corresponds to the error codes. This function must be call before using the error struct instance.

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axutil_error_set_error_message | ( | struct axutil_error * | error,
|  | axis2_char_t * | message |
| ) |  |  |

Sets error message to the given value.

Parameters:

  | error | pointer to error struct
  | message | error message to be set

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axutil_error_set_error_number | ( | struct axutil_error * | error,
|  | axutil_error_codes_t | error_number |
| ) |  |  |

This function is supposed to be overridden in an extended error structure. For example in Sandesha error structure this function is overridden so that errors of axis2 range call the get_message function of error struct but errors of sandesha2 range get the messages from an array of that struct.

Returns:
  error message for the extended struct.

Deprecated:
  this function is not in use, so should be removed.

Sets the error number.

Parameters:

  | error | pointer to error struct
  | error_number | error number to be set

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axutil_error_set_status_code | ( | struct axutil_error * | error,
|  | axis2_status_codes_t | status_code |
| ) |  |  |

Sets the status code.

Parameters:

  | error | pointer to error struct
  | status_code | status code to be set

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE