Main Page | Modules | Data Structures | File List | Data Fields | Globals

error creation and destruction

SVN error creation and destruction. More...

Defines

#define svn_error_create   (svn_error__locate(__FILE__,__LINE__), (svn_error_create))
 Wrapper macro to collect file and line information.

#define svn_error_createf   (svn_error__locate(__FILE__,__LINE__), (svn_error_createf))
 Wrapper macro to collect file and line information.

#define svn_error_wrap_apr   (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr))
 Wrapper macro to collect file and line information.

#define svn_error_quick_wrap   (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap))
 Wrapper macro to collect file and line information.

#define SVN_ERR(expr)
 A statement macro for checking error return values.

#define SVN_ERR_W(expr, wrap_msg)
 A statement macro, very similar to SVN_ERR.

#define SVN_INT_ERR(expr)
 A statement macro, similar to SVN_ERR, but returns an integer.


Typedefs

typedef svn_error_t svn_error_t
 Subversion error object.


Functions

svn_error_tsvn_error_create (apr_status_t apr_err, svn_error_t *child, const char *message)
 Create a nested exception structure.

svn_error_tsvn_error_createf (apr_status_t apr_err, svn_error_t *child, const char *fmt,...) __attribute__((format(printf
 Create an error structure with the given apr_err and child, with a printf-style error message produced by passing fmt, using apr_psprintf.

svn_error_tsvn_error_wrap_apr (apr_status_t status, const char *fmt,...)
 Wrap a status from an APR function.

svn_error_tsvn_error_quick_wrap (svn_error_t *child, const char *new_msg)
 A quick n' easy way to create a wrappered exception with your own message, before throwing it up the stack.

void svn_error_compose (svn_error_t *chain, svn_error_t *new_err)
 Add new_err to the end of chain's chain of errors.

void svn_error_clear (svn_error_t *error)
 Free the memory used by error, as well as all ancestors and descendants of error.

void svn_handle_error (svn_error_t *error, FILE *stream, svn_boolean_t fatal)
 Very basic default error handler: print out error stack, and quit iff the fatal flag is set.

void svn_handle_warning (FILE *stream, svn_error_t *error)
 Basic, default warning handler.


Detailed Description

SVN error creation and destruction.


Define Documentation

#define SVN_ERR expr   ) 
 

Value:

do {                                          \
    svn_error_t *svn_err__temp = (expr);        \
    if (svn_err__temp)                          \
      return svn_err__temp;                     \
  } while (0)
A statement macro for checking error return values.

Evaluate expr. If it yields an error, return that error from the current function. Otherwise, continue.

The do { ... } while (0) wrapper has no semantic effect, but it makes this macro syntactically equivalent to the expression statement it resembles. Without it, statements like

if (a) SVN_ERR (some operation); else foo;

would not mean what they appear to.

Definition at line 183 of file svn_error.h.

#define SVN_ERR_W expr,
wrap_msg   ) 
 

Value:

do {                                                      \
    svn_error_t *svn_err__temp = (expr);                    \
    if (svn_err__temp)                                      \
      return svn_error_quick_wrap(svn_err__temp, wrap_msg); \
  } while (0)
A statement macro, very similar to SVN_ERR.

This macro will wrap the error with the specified text before returning the error.

Definition at line 196 of file svn_error.h.

#define SVN_INT_ERR expr   ) 
 

Value:

do {                                                      \
    svn_error_t *svn_err__temp = (expr);                    \
    if (svn_err__temp) {                                    \
      svn_handle_error (svn_err__temp, stderr, FALSE);      \
      svn_error_clear (svn_err__temp);                      \
      return EXIT_FAILURE; }                                \
  } while (0)
A statement macro, similar to SVN_ERR, but returns an integer.

Evaluate expr. If it yields an error, handle that error and return EXIT_FAILURE.

Definition at line 209 of file svn_error.h.


Typedef Documentation

svn_error_t
 

Subversion error object.

Defined here, rather than in svn_error.h, to avoid a recursive #include situation.

Definition at line 101 of file svn_error.h.


Function Documentation

void svn_error_clear svn_error_t error  ) 
 

Free the memory used by error, as well as all ancestors and descendants of error.

Unlike other Subversion objects, errors are managed explicitly; you MUST clear an error if you are ignoring it, or you are leaking memory. For convenience, error may be NULL, in which case this function does nothing; thus, svn_error_clear(svn_foo(...)) works as an idiom to ignore errors.

void svn_error_compose svn_error_t chain,
svn_error_t new_err
 

Add new_err to the end of chain's chain of errors.

The new_err chain will be copied into chain's pool and destroyed, so new_err itself becomes invalid after this function.

svn_error_t* svn_error_create apr_status_t  apr_err,
svn_error_t child,
const char *  message
 

Create a nested exception structure.

Input: an APR or SVN custom error code, a "child" error to wrap, a specific message

Returns: a new error structure (containing the old one).

Notes: Errors are always allocated in a subpool of the global pool, since an error's lifetime is generally not related to the lifetime of any convenient pool. Errors must be freed with svn_error_clear(). The specific message should be NULL if there is nothing to add to the general message associated with the error code.

If creating the "bottommost" error in a chain, pass NULL for the child argument.

svn_error_t* svn_error_quick_wrap svn_error_t child,
const char *  new_msg
 

A quick n' easy way to create a wrappered exception with your own message, before throwing it up the stack.

(It uses all of the child's fields.)

svn_error_t* svn_error_wrap_apr apr_status_t  status,
const char *  fmt,
... 
 

Wrap a status from an APR function.

If fmt is NULL, this is equivalent to svn_error_create(status, NULL, NULL). Otherwise, the error message is constructed by formatting fmt and the following arguments according to apr_psprintf, and then appending ": " and the error message corresponding to status. (If UTF-8 translation of the APR error message fails, the ": " and APR error are not appended to the error message.)

void svn_handle_warning FILE *  stream,
svn_error_t error
 

Basic, default warning handler.

Just prints error to the stdio stream given in stream. Allocations are performed in the error's pool.


Generated on Mon Oct 18 17:33:15 2004 for Subversion by doxygen 1.3.5