31 #include <apr_errno.h> 32 #include <apr_pools.h> 34 #ifndef DOXYGEN_SHOULD_SKIP_THIS 35 #define APR_WANT_STDIO 49 #define SVN_ERR__TRACING 54 #define SVN_NO_ERROR 0 141 const char *message);
152 __attribute__ ((format(printf, 3, 4)));
166 __attribute__((format(printf, 2, 3)));
175 const
char *new_msg);
185 __attribute__((format(printf, 2, 3)));
255 #if defined(SVN_ERR__TRACING) 258 svn_error__locate(
const char *file,
262 #define svn_error_create \ 263 (svn_error__locate(__FILE__,__LINE__), (svn_error_create)) 264 #define svn_error_createf \ 265 (svn_error__locate(__FILE__,__LINE__), (svn_error_createf)) 266 #define svn_error_wrap_apr \ 267 (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr)) 268 #define svn_error_quick_wrap \ 269 (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap)) 270 #define svn_error_quick_wrapf \ 271 (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrapf)) 351 #define SVN_ERR(expr) \ 353 svn_error_t *svn_err__temp = (expr); \ 355 return svn_error_trace(svn_err__temp); \ 367 #ifdef SVN_ERR__TRACING 369 svn_error__trace(
const char *file,
long line,
svn_error_t *err);
371 #define svn_error_trace(expr) svn_error__trace(__FILE__, __LINE__, (expr)) 373 #define svn_error_trace(expr) (expr) 402 #define SVN_ERR_W(expr, wrap_msg) \ 404 svn_error_t *svn_err__temp = (expr); \ 406 return svn_error_quick_wrap(svn_err__temp, wrap_msg); \ 422 #define SVN_INT_ERR(expr) \ 424 svn_error_t *svn_err__temp = (expr); \ 425 if (svn_err__temp) { \ 426 svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: "); \ 427 svn_error_clear(svn_err__temp); \ 428 return EXIT_FAILURE; } \ 451 #define SVN_ERR_IS_LOCK_ERROR(err) \ 452 (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \ 453 err->apr_err == SVN_ERR_FS_NOT_FOUND || \ 454 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \ 455 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \ 456 err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE || \ 457 err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION || \ 458 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \ 459 err->apr_err == SVN_ERR_FS_NOT_FILE) 469 #define SVN_ERR_IS_UNLOCK_ERROR(err) \ 470 (err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED || \ 471 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \ 472 err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \ 473 err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \ 474 err->apr_err == SVN_ERR_RA_NOT_LOCKED || \ 475 err->apr_err == SVN_ERR_FS_LOCK_EXPIRED || \ 476 err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE) 484 #define SVN_ERROR_IN_CATEGORY(apr_err, category) \ 485 ((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE) 511 #define SVN_ERR_MALFUNCTION() \ 513 return svn_error_trace(svn_error__malfunction( \ 514 TRUE, __FILE__, __LINE__, NULL)); \ 524 #define SVN_ERR_MALFUNCTION_NO_RETURN() \ 526 svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \ 539 #ifdef __clang_analyzer__ 542 #define SVN_ERR_ASSERT_E(expr, err) assert((expr)) 544 #define SVN_ERR_ASSERT_E(expr, err) \ 547 return svn_error_compose_create( \ 548 svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \ 576 #ifdef __clang_analyzer__ 578 #define SVN_ERR_ASSERT(expr) assert((expr)) 580 #define SVN_ERR_ASSERT(expr) \ 583 SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \ 594 #define SVN_ERR_ASSERT_NO_RETURN(expr) \ 597 svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \ 603 #define SVN__NOT_IMPLEMENTED() \ 604 return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.") 648 typedef svn_error_t *(*svn_error_malfunction_handler_t)
void svn_handle_warning2(FILE *stream, const svn_error_t *error, const char *prefix)
Very basic default warning handler: print out the error error to the stdio stream stream...
svn_error_t * svn_error_quick_wrap(svn_error_t *child, const char *new_msg)
If child is SVN_NO_ERROR, return SVN_NO_ERROR.
const char * svn_error_symbolic_name(apr_status_t statcode)
Return the symbolic name of an error code.
svn_error_t *(* svn_error_malfunction_handler_t)(svn_boolean_t can_return, const char *file, int line, const char *expr)
A type of function that handles an assertion failure or other internal malfunction detected within th...
void svn_handle_error2(svn_error_t *error, FILE *stream, svn_boolean_t fatal, const char *prefix)
Very basic default error handler: print out error stack error to the stdio stream stream...
svn_error_malfunction_handler_t svn_error_get_malfunction_handler(void)
Return the malfunction handler that is currently in effect.
svn_error_t * svn_error_raise_on_malfunction(svn_boolean_t can_return, const char *file, int line, const char *expr)
Handle a malfunction by returning an error object that describes it.
svn_error_t * svn_error_compose_create(svn_error_t *err1, svn_error_t *err2)
Compose two errors, returning the composition as a brand new error and consuming the original errors...
svn_error_t * svn_error_quick_wrapf(svn_error_t *child, const char *fmt,...)
Like svn_error_quick_wrap(), but with format string support.
svn_error_t * svn_error_abort_on_malfunction(svn_boolean_t can_return, const char *file, int line, const char *expr)
Handle a malfunction by printing a message to stderr and aborting.
svn_error_t * svn_error_createf(apr_status_t apr_err, svn_error_t *child, const char *fmt,...)
Create an error structure with the given apr_err and child, with a printf-style error message produce...
svn_error_t * svn_error_wrap_apr(apr_status_t status, const char *fmt,...)
Wrap a status from an APR function.
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.
Subversion's data types.
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
void svn_handle_error(svn_error_t *error, FILE *stream, svn_boolean_t fatal)
Like svn_handle_error2() but with prefix set to "svn: ".
svn_error_t * svn_error_find_cause(svn_error_t *err, apr_status_t apr_err)
Return the first error in err's chain that has an error code apr_err or SVN_NO_ERROR if there is no e...
svn_error_malfunction_handler_t svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func)
Cause subsequent malfunctions to be handled by func.
const char * svn_err_best_message(const svn_error_t *err, char *buf, apr_size_t bufsize)
If err has a custom error message, return that, otherwise store the generic error string associated w...
svn_error_t * svn_error_dup(const svn_error_t *err)
Create a new error that is a deep copy of err and return it.
void svn_error_clear(svn_error_t *error)
Free the memory used by error, as well as all ancestors and descendants of error. ...
svn_error_t * svn_error__malfunction(svn_boolean_t can_return, const char *file, int line, const char *expr)
A helper function for the macros that report malfunctions.
svn_error_t * svn_error_root_cause(svn_error_t *err)
Return the root cause of err by finding the last error in its chain (e.g.
svn_error_t * svn_error_create(apr_status_t apr_err, svn_error_t *child, const char *message)
Create a nested exception structure.
char * svn_strerror(apr_status_t statcode, char *buf, apr_size_t bufsize)
Put an English description of statcode into buf and return buf, NULL-terminated.
int svn_boolean_t
YABT: Yet Another Boolean Type.
svn_error_t * svn_error_purge_tracing(svn_error_t *err)
Returns an error chain that is based on err's error chain but does not include any error tracing plac...
void svn_handle_warning(FILE *stream, svn_error_t *error)
Like svn_handle_warning2() but with prefix set to "svn: ".