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
111 const char *message);
122 __attribute__ ((format(printf, 3, 4)));
136 __attribute__((format(printf, 2, 3)));
144 const
char *new_msg);
213 #if defined(SVN_DEBUG)
216 svn_error__locate(
const char *file,
220 #define svn_error_create \
221 (svn_error__locate(__FILE__,__LINE__), (svn_error_create))
222 #define svn_error_createf \
223 (svn_error__locate(__FILE__,__LINE__), (svn_error_createf))
224 #define svn_error_wrap_apr \
225 (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr))
226 #define svn_error_quick_wrap \
227 (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap))
301 #define SVN_ERR(expr) \
303 svn_error_t *svn_err__temp = (expr); \
305 return svn_error_trace(svn_err__temp); \
317 #ifdef SVN_ERR__TRACING
318 #define SVN_ERR__TRACED "traced call"
320 #define svn_error_trace(expr) svn_error_quick_wrap((expr), SVN_ERR__TRACED)
322 #define svn_error_trace(expr) (expr)
351 #define SVN_ERR_W(expr, wrap_msg) \
353 svn_error_t *svn_err__temp = (expr); \
355 return svn_error_quick_wrap(svn_err__temp, wrap_msg); \
364 #define SVN_INT_ERR(expr) \
366 svn_error_t *svn_err__temp = (expr); \
367 if (svn_err__temp) { \
368 svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: "); \
369 svn_error_clear(svn_err__temp); \
370 return EXIT_FAILURE; } \
391 #define SVN_ERR_IS_LOCK_ERROR(err) \
392 (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \
393 err->apr_err == SVN_ERR_FS_NOT_FOUND || \
394 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \
395 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN)
403 #define SVN_ERR_IS_UNLOCK_ERROR(err) \
404 (err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED || \
405 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \
406 err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \
407 err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \
408 err->apr_err == SVN_ERR_RA_NOT_LOCKED || \
409 err->apr_err == SVN_ERR_FS_LOCK_EXPIRED)
417 #define SVN_ERROR_IN_CATEGORY(apr_err, category) \
418 ((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE)
444 #define SVN_ERR_MALFUNCTION() \
446 return svn_error_trace(svn_error__malfunction( \
447 TRUE, __FILE__, __LINE__, NULL)); \
457 #define SVN_ERR_MALFUNCTION_NO_RETURN() \
459 svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \
482 #define SVN_ERR_ASSERT(expr) \
485 SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
495 #define SVN_ERR_ASSERT_NO_RETURN(expr) \
498 svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \
504 #define SVN__NOT_IMPLEMENTED() \
505 return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.")
549 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...
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...
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_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_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.
void svn_handle_warning2(FILE *stream, svn_error_t *error, const char *prefix)
Very basic default warning handler: print out the error error to the stdio stream stream...
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...
const char * svn_err_best_message(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_malfunction_handler_t svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func)
Cause subsequent malfunctions to be handled by func.
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_dup(svn_error_t *err)
Create a new error that is a deep copy of err and return it.
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: ".