svn_error.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_error.h
00024  * @brief Common exception handling for Subversion.
00025  */
00026 
00027 #ifndef SVN_ERROR_H
00028 #define SVN_ERROR_H
00029 
00030 #include <apr.h>        /* for apr_size_t */
00031 #include <apr_errno.h>  /* APR's error system */
00032 #include <apr_pools.h>  /* for apr_pool_t */
00033 
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 #define APR_WANT_STDIO
00036 #endif
00037 #include <apr_want.h>   /* for FILE* */
00038 
00039 #include "svn_types.h"
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif /* __cplusplus */
00044 
00045 
00046 /* For the Subversion developers, this #define turns on extended "stack
00047    traces" of any errors that get thrown. See the SVN_ERR() macro.  */
00048 #ifdef SVN_DEBUG
00049 #define SVN_ERR__TRACING
00050 #endif
00051 
00052 
00053 /** the best kind of (@c svn_error_t *) ! */
00054 #define SVN_NO_ERROR   0
00055 
00056 /* The actual error codes are kept in a separate file; see comments
00057    there for the reasons why. */
00058 #include "svn_error_codes.h"
00059 
00060 /** Put an English description of @a statcode into @a buf and return @a buf,
00061  * NULL-terminated. @a statcode is either an svn error or apr error.
00062  */
00063 char *
00064 svn_strerror(apr_status_t statcode,
00065              char *buf,
00066              apr_size_t bufsize);
00067 
00068 
00069 /**
00070  * Return the symbolic name of an error code.  If the error code
00071  * is in svn_error_codes.h, return the name of the macro as a string.
00072  * If the error number is not recognised, return @c NULL.
00073  *
00074  * An error number may not be recognised because it was defined in a future
00075  * version of Subversion (e.g., a 1.9.x server may transmit a defined-in-1.9.0
00076  * error number to a 1.8.x client).
00077  *
00078  * An error number may be recognised @em incorrectly if the @c apr_status_t
00079  * value originates in another library (such as libserf) which also uses APR.
00080  * (This is a theoretical concern only: the @c apr_err member of #svn_error_t
00081  * should never contain a "foreign" @c apr_status_t value, and
00082  * in any case Subversion and Serf use non-overlapping subsets of the
00083  * @c APR_OS_START_USERERR range.)
00084  *
00085  * Support for error codes returned by APR itself (i.e., not in the
00086  * @c APR_OS_START_USERERR range, as defined in apr_errno.h) may be implemented
00087  * in the future.
00088  *
00089  * @note In rare cases, a single numeric code has more than one symbolic name.
00090  * (For example, #SVN_ERR_WC_NOT_DIRECTORY and #SVN_ERR_WC_NOT_WORKING_COPY).
00091  * In those cases, it is not guaranteed which symbolic name is returned.
00092  *
00093  * @since New in 1.8.
00094  */
00095 const char *
00096 svn_error_symbolic_name(apr_status_t statcode);
00097 
00098 
00099 /** If @a err has a custom error message, return that, otherwise
00100  * store the generic error string associated with @a err->apr_err into
00101  * @a buf (terminating with NULL) and return @a buf.
00102  *
00103  * @since New in 1.4.
00104  *
00105  * @note @a buf and @a bufsize are provided in the interface so that
00106  * this function is thread-safe and yet does no allocation.
00107  */
00108 const char *svn_err_best_message(svn_error_t *err,
00109                                  char *buf,
00110                                  apr_size_t bufsize);
00111 
00112 
00113 
00114 /** SVN error creation and destruction.
00115  *
00116  * @defgroup svn_error_error_creation_destroy Error creation and destruction
00117  * @{
00118  */
00119 
00120 /** Create a nested exception structure.
00121  *
00122  * Input:  an APR or SVN custom error code,
00123  *         a "child" error to wrap,
00124  *         a specific message
00125  *
00126  * Returns:  a new error structure (containing the old one).
00127  *
00128  * @note Errors are always allocated in a subpool of the global pool,
00129  *        since an error's lifetime is generally not related to the
00130  *        lifetime of any convenient pool.  Errors must be freed
00131  *        with svn_error_clear().  The specific message should be @c NULL
00132  *        if there is nothing to add to the general message associated
00133  *        with the error code.
00134  *
00135  *        If creating the "bottommost" error in a chain, pass @c NULL for
00136  *        the child argument.
00137  */
00138 svn_error_t *
00139 svn_error_create(apr_status_t apr_err,
00140                  svn_error_t *child,
00141                  const char *message);
00142 
00143 /** Create an error structure with the given @a apr_err and @a child,
00144  * with a printf-style error message produced by passing @a fmt, using
00145  * apr_psprintf().
00146  */
00147 svn_error_t *
00148 svn_error_createf(apr_status_t apr_err,
00149                   svn_error_t *child,
00150                   const char *fmt,
00151                   ...)
00152   __attribute__ ((format(printf, 3, 4)));
00153 
00154 /** Wrap a @a status from an APR function.  If @a fmt is NULL, this is
00155  * equivalent to svn_error_create(status,NULL,NULL).  Otherwise,
00156  * the error message is constructed by formatting @a fmt and the
00157  * following arguments according to apr_psprintf(), and then
00158  * appending ": " and the error message corresponding to @a status.
00159  * (If UTF-8 translation of the APR error message fails, the ": " and
00160  * APR error are not appended to the error message.)
00161  */
00162 svn_error_t *
00163 svn_error_wrap_apr(apr_status_t status,
00164                    const char *fmt,
00165                    ...)
00166        __attribute__((format(printf, 2, 3)));
00167 
00168 /** A quick n' easy way to create a wrapped exception with your own
00169  * message, before throwing it up the stack.  (It uses all of the
00170  * @a child's fields.)
00171  */
00172 svn_error_t *
00173 svn_error_quick_wrap(svn_error_t *child,
00174                      const char *new_msg);
00175 
00176 /** Compose two errors, returning the composition as a brand new error
00177  * and consuming the original errors.  Either or both of @a err1 and
00178  * @a err2 may be @c SVN_NO_ERROR.  If both are not @c SVN_NO_ERROR,
00179  * @a err2 will follow @a err1 in the chain of the returned error.
00180  *
00181  * Either @a err1 or @a err2 can be functions that return svn_error_t*
00182  * but if both are functions they can be evaluated in either order as
00183  * per the C language rules.
00184  *
00185  * @since New in 1.6.
00186  */
00187 svn_error_t *
00188 svn_error_compose_create(svn_error_t *err1,
00189                          svn_error_t *err2);
00190 
00191 /** Add @a new_err to the end of @a chain's chain of errors.  The @a new_err
00192  * chain will be copied into @a chain's pool and destroyed, so @a new_err
00193  * itself becomes invalid after this function.
00194  *
00195  * Either @a chain or @a new_err can be functions that return svn_error_t*
00196  * but if both are functions they can be evaluated in either order as
00197  * per the C language rules.
00198  */
00199 void
00200 svn_error_compose(svn_error_t *chain,
00201                   svn_error_t *new_err);
00202 
00203 /** Return the root cause of @a err by finding the last error in its
00204  * chain (e.g. it or its children).  @a err may be @c SVN_NO_ERROR, in
00205  * which case @c SVN_NO_ERROR is returned.
00206  *
00207  * @since New in 1.5.
00208  */
00209 svn_error_t *
00210 svn_error_root_cause(svn_error_t *err);
00211 
00212 /** Return the first error in @a err's chain that has an error code @a
00213  * apr_err or #SVN_NO_ERROR if there is no error with that code.  The
00214  * returned error should @em not be cleared as it shares memory with @a err.
00215  *
00216  * If @a err is #SVN_NO_ERROR, return #SVN_NO_ERROR.
00217  *
00218  * @since New in 1.7.
00219  */
00220 svn_error_t *
00221 svn_error_find_cause(svn_error_t *err, apr_status_t apr_err);
00222 
00223 /** Create a new error that is a deep copy of @a err and return it.
00224  *
00225  * @since New in 1.2.
00226  */
00227 svn_error_t *
00228 svn_error_dup(svn_error_t *err);
00229 
00230 /** Free the memory used by @a error, as well as all ancestors and
00231  * descendants of @a error.
00232  *
00233  * Unlike other Subversion objects, errors are managed explicitly; you
00234  * MUST clear an error if you are ignoring it, or you are leaking memory.
00235  * For convenience, @a error may be @c NULL, in which case this function does
00236  * nothing; thus, svn_error_clear(svn_foo(...)) works as an idiom to
00237  * ignore errors.
00238  */
00239 void
00240 svn_error_clear(svn_error_t *error);
00241 
00242 
00243 #if defined(SVN_ERR__TRACING)
00244 /** Set the error location for debug mode. */
00245 void
00246 svn_error__locate(const char *file,
00247                   long line);
00248 
00249 /* Wrapper macros to collect file and line information */
00250 #define svn_error_create \
00251   (svn_error__locate(__FILE__,__LINE__), (svn_error_create))
00252 #define svn_error_createf \
00253   (svn_error__locate(__FILE__,__LINE__), (svn_error_createf))
00254 #define svn_error_wrap_apr \
00255   (svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr))
00256 #define svn_error_quick_wrap \
00257   (svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap))
00258 #endif
00259 
00260 
00261 /**
00262  * Very basic default error handler: print out error stack @a error to the
00263  * stdio stream @a stream, with each error prefixed by @a prefix; quit and
00264  * clear @a error iff the @a fatal flag is set.  Allocations are performed
00265  * in the @a error's pool.
00266  *
00267  * If you're not sure what prefix to pass, just pass "svn: ".  That's
00268  * what code that used to call svn_handle_error() and now calls
00269  * svn_handle_error2() does.
00270  *
00271  * @since New in 1.2.
00272  */
00273 void
00274 svn_handle_error2(svn_error_t *error,
00275                   FILE *stream,
00276                   svn_boolean_t fatal,
00277                   const char *prefix);
00278 
00279 /** Like svn_handle_error2() but with @c prefix set to "svn: "
00280  *
00281  * @deprecated Provided for backward compatibility with the 1.1 API.
00282  */
00283 SVN_DEPRECATED
00284 void
00285 svn_handle_error(svn_error_t *error,
00286                  FILE *stream,
00287                  svn_boolean_t fatal);
00288 
00289 /**
00290  * Very basic default warning handler: print out the error @a error to the
00291  * stdio stream @a stream, prefixed by @a prefix.  Allocations are
00292  * performed in the error's pool.
00293  *
00294  * @a error may not be @c NULL.
00295  *
00296  * @since New in 1.2.
00297  */
00298 void
00299 svn_handle_warning2(FILE *stream,
00300                     svn_error_t *error,
00301                     const char *prefix);
00302 
00303 /** Like svn_handle_warning2() but with @c prefix set to "svn: "
00304  *
00305  * @deprecated Provided for backward compatibility with the 1.1 API.
00306  */
00307 SVN_DEPRECATED
00308 void
00309 svn_handle_warning(FILE *stream,
00310                    svn_error_t *error);
00311 
00312 
00313 /** A statement macro for checking error values.
00314  *
00315  * Evaluate @a expr.  If it yields an error, return that error from the
00316  * current function.  Otherwise, continue.
00317  *
00318  * The <tt>do { ... } while (0)</tt> wrapper has no semantic effect,
00319  * but it makes this macro syntactically equivalent to the expression
00320  * statement it resembles.  Without it, statements like
00321  *
00322  * @code
00323  *   if (a)
00324  *     SVN_ERR(some operation);
00325  *   else
00326  *     foo;
00327  * @endcode
00328  *
00329  * would not mean what they appear to.
00330  */
00331 #define SVN_ERR(expr)                           \
00332   do {                                          \
00333     svn_error_t *svn_err__temp = (expr);        \
00334     if (svn_err__temp)                          \
00335       return svn_error_trace(svn_err__temp);    \
00336   } while (0)
00337 
00338 /**
00339  * A macro for wrapping an error in a source-location trace message.
00340  *
00341  * This macro can be used when directly returning an already created
00342  * error (when not using SVN_ERR, svn_error_create(), etc.) to ensure
00343  * that the call stack is recorded correctly.
00344  *
00345  * @since New in 1.7.
00346  */
00347 #ifdef SVN_ERR__TRACING
00348 svn_error_t *
00349 svn_error__trace(const char *file, long line, svn_error_t *err);
00350 
00351 #define svn_error_trace(expr)  svn_error__trace(__FILE__, __LINE__, (expr))
00352 #else
00353 #define svn_error_trace(expr)  (expr)
00354 #endif
00355 
00356 /**
00357  * Returns an error chain that is based on @a err's error chain but
00358  * does not include any error tracing placeholders.  @a err is not
00359  * modified, except for any allocations using its pool.
00360  *
00361  * The returned error chain is allocated from @a err's pool and shares
00362  * its message and source filename character arrays.  The returned
00363  * error chain should *not* be cleared because it is not a fully
00364  * fledged error chain, only clearing @a err should be done to clear
00365  * the returned error chain.  If @a err is cleared, then the returned
00366  * error chain is unusable.
00367  *
00368  * @a err can be #SVN_NO_ERROR.  If @a err is not #SVN_NO_ERROR, then
00369  * the last link in the error chain must be a non-tracing error, i.e,
00370  * a real error.
00371  *
00372  * @since New in 1.7.
00373  */
00374 svn_error_t *svn_error_purge_tracing(svn_error_t *err);
00375 
00376 
00377 /** A statement macro, very similar to @c SVN_ERR.
00378  *
00379  * This macro will wrap the error with the specified text before
00380  * returning the error.
00381  */
00382 #define SVN_ERR_W(expr, wrap_msg)                           \
00383   do {                                                      \
00384     svn_error_t *svn_err__temp = (expr);                    \
00385     if (svn_err__temp)                                      \
00386       return svn_error_quick_wrap(svn_err__temp, wrap_msg); \
00387   } while (0)
00388 
00389 
00390 /** A statement macro, similar to @c SVN_ERR, but returns an integer.
00391  *
00392  * Evaluate @a expr. If it yields an error, handle that error and
00393  * return @c EXIT_FAILURE.
00394  */
00395 #define SVN_INT_ERR(expr)                                        \
00396   do {                                                           \
00397     svn_error_t *svn_err__temp = (expr);                         \
00398     if (svn_err__temp) {                                         \
00399       svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: ");  \
00400       svn_error_clear(svn_err__temp);                            \
00401       return EXIT_FAILURE; }                                     \
00402   } while (0)
00403 
00404 /** @} */
00405 
00406 
00407 /** Error groups
00408  *
00409  * @defgroup svn_error_error_groups Error groups
00410  * @{
00411  */
00412 
00413 /**
00414  * Return TRUE if @a err is an error specifically related to locking a
00415  * path in the repository, FALSE otherwise.
00416  *
00417  * SVN_ERR_FS_OUT_OF_DATE and SVN_ERR_FS_NOT_FOUND are in here because it's a
00418  * non-fatal error that can be thrown when attempting to lock an item.
00419  *
00420  * @since New in 1.2.
00421  */
00422 #define SVN_ERR_IS_LOCK_ERROR(err)                          \
00423   (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED ||        \
00424    err->apr_err == SVN_ERR_FS_NOT_FOUND           ||        \
00425    err->apr_err == SVN_ERR_FS_OUT_OF_DATE         ||        \
00426    err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN)
00427 
00428 /**
00429  * Return TRUE if @a err is an error specifically related to unlocking
00430  * a path in the repository, FALSE otherwise.
00431  *
00432  * @since New in 1.2.
00433  */
00434 #define SVN_ERR_IS_UNLOCK_ERROR(err)                        \
00435   (err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED ||            \
00436    err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN ||             \
00437    err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH ||        \
00438    err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK ||               \
00439    err->apr_err == SVN_ERR_RA_NOT_LOCKED ||                 \
00440    err->apr_err == SVN_ERR_FS_LOCK_EXPIRED)
00441 
00442 /** Evaluates to @c TRUE iff @a apr_err (of type apr_status_t) is in the given
00443  * @a category, which should be one of the @c SVN_ERR_*_CATEGORY_START
00444  * constants.
00445  *
00446  * @since New in 1.7.
00447  */
00448 #define SVN_ERROR_IN_CATEGORY(apr_err, category)            \
00449     ((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE)
00450 
00451 
00452 /** @} */
00453 
00454 
00455 /** Internal malfunctions and assertions
00456  *
00457  * @defgroup svn_error_malfunction_assertion Malfunctions and assertions
00458  * @{
00459  */
00460 
00461 /** Report that an internal malfunction has occurred, and possibly terminate
00462  * the program.
00463  *
00464  * Act as determined by the current "malfunction handler" which may have
00465  * been specified by a call to svn_error_set_malfunction_handler() or else
00466  * is the default handler as specified in that function's documentation. If
00467  * the malfunction handler returns, then cause the function using this macro
00468  * to return the error object that it generated.
00469  *
00470  * @note The intended use of this macro is where execution reaches a point
00471  * that cannot possibly be reached unless there is a bug in the program.
00472  *
00473  * @since New in 1.6.
00474  */
00475 #define SVN_ERR_MALFUNCTION()                                      \
00476   do {                                                             \
00477     return svn_error_trace(svn_error__malfunction(                 \
00478                                  TRUE, __FILE__, __LINE__, NULL)); \
00479   } while (0)
00480 
00481 /** Similar to SVN_ERR_MALFUNCTION(), but without the option of returning
00482  * an error to the calling function.
00483  *
00484  * If possible you should use SVN_ERR_MALFUNCTION() instead.
00485  *
00486  * @since New in 1.6.
00487  */
00488 #define SVN_ERR_MALFUNCTION_NO_RETURN()                      \
00489   do {                                                       \
00490     svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \
00491     abort();                                                 \
00492   } while (1)
00493 
00494 /** Like SVN_ERR_ASSERT(), but append ERR to the returned error chain.
00495  *
00496  * If EXPR is false, return a malfunction error whose chain includes ERR.
00497  * If EXPR is true, do nothing.  (In particular, this does not clear ERR.)
00498  *
00499  * Types: (svn_boolean_t expr, svn_error_t *err)
00500  *
00501  * @since New in 1.8.
00502  */
00503 #ifdef __clang_analyzer__
00504 #include <assert.h>
00505 /* Just ignore ERR.  If the assert triggers, it'll be our least concern. */
00506 #define SVN_ERR_ASSERT_E(expr, err)       assert((expr))
00507 #else
00508 #define SVN_ERR_ASSERT_E(expr, err)                                      \
00509   do {                                                                  \
00510     if (!(expr)) {                                                      \
00511       return svn_error_compose_create(                                  \
00512                svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \
00513                (err));                                                  \
00514     }                                                                   \
00515   } while (0)
00516 #endif
00517 
00518 
00519 /** Check that a condition is true: if not, report an error and possibly
00520  * terminate the program.
00521  *
00522  * If the Boolean expression @a expr is true, do nothing. Otherwise,
00523  * act as determined by the current "malfunction handler" which may have
00524  * been specified by a call to svn_error_set_malfunction_handler() or else
00525  * is the default handler as specified in that function's documentation. If
00526  * the malfunction handler returns, then cause the function using this macro
00527  * to return the error object that it generated.
00528  *
00529  * @note The intended use of this macro is to check a condition that cannot
00530  * possibly be false unless there is a bug in the program.
00531  *
00532  * @note The condition to be checked should not be computationally expensive
00533  * if it is reached often, as, unlike traditional "assert" statements, the
00534  * evaluation of this expression is not compiled out in release-mode builds.
00535  *
00536  * @since New in 1.6.
00537  *
00538  * @see SVN_ERR_ASSERT_E()
00539  */
00540 #ifdef __clang_analyzer__
00541 #include <assert.h>
00542 #define SVN_ERR_ASSERT(expr)       assert((expr))
00543 #else
00544 #define SVN_ERR_ASSERT(expr)                                            \
00545   do {                                                                  \
00546     if (!(expr))                                                        \
00547       SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
00548   } while (0)
00549 #endif
00550 
00551 /** Similar to SVN_ERR_ASSERT(), but without the option of returning
00552  * an error to the calling function.
00553  *
00554  * If possible you should use SVN_ERR_ASSERT() instead.
00555  *
00556  * @since New in 1.6.
00557  */
00558 #define SVN_ERR_ASSERT_NO_RETURN(expr)                          \
00559   do {                                                          \
00560     if (!(expr)) {                                              \
00561       svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \
00562       abort();                                                  \
00563     }                                                           \
00564   } while (0)
00565 
00566 /** Report a "Not implemented" malfunction.  Internal use only. */
00567 #define SVN__NOT_IMPLEMENTED() \
00568   return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.")
00569 
00570 /** A helper function for the macros that report malfunctions. Handle a
00571  * malfunction by calling the current "malfunction handler" which may have
00572  * been specified by a call to svn_error_set_malfunction_handler() or else
00573  * is the default handler as specified in that function's documentation.
00574  *
00575  * Pass all of the parameters to the handler. The error occurred in the
00576  * source file @a file at line @a line, and was an assertion failure of the
00577  * expression @a expr, or, if @a expr is null, an unconditional error.
00578  *
00579  * If @a can_return is true, the handler can return an error object
00580  * that is returned by the caller. If @a can_return is false the
00581  * method should never return. (The caller will call abort())
00582  *
00583  * @since New in 1.6.
00584  */
00585 svn_error_t *
00586 svn_error__malfunction(svn_boolean_t can_return,
00587                        const char *file,
00588                        int line,
00589                        const char *expr);
00590 
00591 /** A type of function that handles an assertion failure or other internal
00592  * malfunction detected within the Subversion libraries.
00593  *
00594  * The error occurred in the source file @a file at line @a line, and was an
00595  * assertion failure of the expression @a expr, or, if @a expr is null, an
00596  * unconditional error.
00597  *
00598  * If @a can_return is false a function of this type must never return.
00599  *
00600  * If @a can_return is true a function of this type must do one of:
00601  *   - Return an error object describing the error, using an error code in
00602  *     the category SVN_ERR_MALFUNC_CATEGORY_START.
00603  *   - Never return.
00604  *
00605  * The function may alter its behaviour according to compile-time
00606  * and run-time and even interactive conditions.
00607  *
00608  * @see SVN_ERROR_IN_CATEGORY()
00609  *
00610  * @since New in 1.6.
00611  */
00612 typedef svn_error_t *(*svn_error_malfunction_handler_t)
00613   (svn_boolean_t can_return, const char *file, int line, const char *expr);
00614 
00615 /** Cause subsequent malfunctions to be handled by @a func.
00616  * Return the handler that was previously in effect.
00617  *
00618  * @a func may not be null.
00619  *
00620  * @note The default handler is svn_error_abort_on_malfunction().
00621  *
00622  * @note This function must be called in a single-threaded context.
00623  *
00624  * @since New in 1.6.
00625  */
00626 svn_error_malfunction_handler_t
00627 svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func);
00628 
00629 /** Handle a malfunction by returning an error object that describes it.
00630  *
00631  * When @a can_return is false, abort()
00632  *
00633  * This function implements @c svn_error_malfunction_handler_t.
00634  *
00635  * @since New in 1.6.
00636  */
00637 svn_error_t *
00638 svn_error_raise_on_malfunction(svn_boolean_t can_return,
00639                                const char *file,
00640                                int line,
00641                                const char *expr);
00642 
00643 /** Handle a malfunction by printing a message to stderr and aborting.
00644  *
00645  * This function implements @c svn_error_malfunction_handler_t.
00646  *
00647  * @since New in 1.6.
00648  */
00649 svn_error_t *
00650 svn_error_abort_on_malfunction(svn_boolean_t can_return,
00651                                const char *file,
00652                                int line,
00653                                const char *expr);
00654 
00655 /** @} */
00656 
00657 
00658 #ifdef __cplusplus
00659 }
00660 #endif /* __cplusplus */
00661 
00662 #endif /* SVN_ERROR_H */

Generated on Thu Aug 13 14:53:44 2015 for Subversion by  doxygen 1.4.7