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)));
174 const
char *new_msg);
187 __attribute__((format(printf, 2, 3)));
257 #if defined(SVN_ERR__TRACING)
260 svn_error__locate(
const char *file,
264 #define svn_error_create \
265 (svn_error__locate(__FILE__,__LINE__), (svn_error_create))
266 #define svn_error_createf \
267 (svn_error__locate(__FILE__,__LINE__), (svn_error_createf))
268 #define svn_error_wrap_apr \
269 (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr))
270 #define svn_error_quick_wrap \
271 (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap))
272 #define svn_error_quick_wrapf \
273 (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrapf))
353 #define SVN_ERR(expr) \
355 svn_error_t *svn_err__temp = (expr); \
357 return svn_error_trace(svn_err__temp); \
369 #ifdef SVN_ERR__TRACING
371 svn_error__trace(
const char *file,
long line,
svn_error_t *err);
373 #define svn_error_trace(expr) svn_error__trace(__FILE__, __LINE__, (expr))
375 #define svn_error_trace(expr) (expr)
404 #define SVN_ERR_W(expr, wrap_msg) \
406 svn_error_t *svn_err__temp = (expr); \
408 return svn_error_quick_wrap(svn_err__temp, wrap_msg); \
424 #define SVN_INT_ERR(expr) \
426 svn_error_t *svn_err__temp = (expr); \
427 if (svn_err__temp) { \
428 svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: "); \
429 svn_error_clear(svn_err__temp); \
430 return EXIT_FAILURE; } \
453 #define SVN_ERR_IS_LOCK_ERROR(err) \
454 (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \
455 err->apr_err == SVN_ERR_FS_NOT_FOUND || \
456 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \
457 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \
458 err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE || \
459 err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION || \
460 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \
461 err->apr_err == SVN_ERR_FS_NOT_FILE)
471 #define SVN_ERR_IS_UNLOCK_ERROR(err) \
472 (err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED || \
473 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \
474 err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \
475 err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \
476 err->apr_err == SVN_ERR_RA_NOT_LOCKED || \
477 err->apr_err == SVN_ERR_FS_LOCK_EXPIRED || \
478 err->apr_err == SVN_ERR_REPOS_HOOK_FAILURE)
486 #define SVN_ERROR_IN_CATEGORY(apr_err, category) \
487 ((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE)
513 #define SVN_ERR_MALFUNCTION() \
515 return svn_error_trace(svn_error__malfunction( \
516 TRUE, __FILE__, __LINE__, NULL)); \
526 #define SVN_ERR_MALFUNCTION_NO_RETURN() \
528 svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \
541 #ifdef __clang_analyzer__
544 #define SVN_ERR_ASSERT_E(expr, err) assert((expr))
546 #define SVN_ERR_ASSERT_E(expr, err) \
549 return svn_error_compose_create( \
550 svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \
578 #ifdef __clang_analyzer__
580 #define SVN_ERR_ASSERT(expr) assert((expr))
582 #define SVN_ERR_ASSERT(expr) \
585 SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
596 #define SVN_ERR_ASSERT_NO_RETURN(expr) \
599 svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \
605 #define SVN__NOT_IMPLEMENTED() \
606 return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.")
650 typedef svn_error_t *(*svn_error_malfunction_handler_t)
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_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)
A quick n' easy way to create a wrapped exception with your own message, before throwing it up the st...
const char * svn_error_symbolic_name(apr_status_t statcode)
Return the symbolic name of an error code.
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,...)
A quick n' easy way to create a wrapped exception with your own printf-style error message produced b...
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: ".