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 * Note that this should only be used from commandline specific code, or 00272 * code that knows that @a stream is really where the application wants 00273 * to receive its errors on. 00274 * 00275 * @since New in 1.2. 00276 */ 00277 void 00278 svn_handle_error2(svn_error_t *error, 00279 FILE *stream, 00280 svn_boolean_t fatal, 00281 const char *prefix); 00282 00283 /** Like svn_handle_error2() but with @c prefix set to "svn: " 00284 * 00285 * @deprecated Provided for backward compatibility with the 1.1 API. 00286 */ 00287 SVN_DEPRECATED 00288 void 00289 svn_handle_error(svn_error_t *error, 00290 FILE *stream, 00291 svn_boolean_t fatal); 00292 00293 /** 00294 * Very basic default warning handler: print out the error @a error to the 00295 * stdio stream @a stream, prefixed by @a prefix. Allocations are 00296 * performed in the error's pool. 00297 * 00298 * @a error may not be @c NULL. 00299 * 00300 * @since New in 1.2. 00301 */ 00302 void 00303 svn_handle_warning2(FILE *stream, 00304 svn_error_t *error, 00305 const char *prefix); 00306 00307 /** Like svn_handle_warning2() but with @c prefix set to "svn: " 00308 * 00309 * @deprecated Provided for backward compatibility with the 1.1 API. 00310 */ 00311 SVN_DEPRECATED 00312 void 00313 svn_handle_warning(FILE *stream, 00314 svn_error_t *error); 00315 00316 00317 /** A statement macro for checking error values. 00318 * 00319 * Evaluate @a expr. If it yields an error, return that error from the 00320 * current function. Otherwise, continue. 00321 * 00322 * The <tt>do { ... } while (0)</tt> wrapper has no semantic effect, 00323 * but it makes this macro syntactically equivalent to the expression 00324 * statement it resembles. Without it, statements like 00325 * 00326 * @code 00327 * if (a) 00328 * SVN_ERR(some operation); 00329 * else 00330 * foo; 00331 * @endcode 00332 * 00333 * would not mean what they appear to. 00334 */ 00335 #define SVN_ERR(expr) \ 00336 do { \ 00337 svn_error_t *svn_err__temp = (expr); \ 00338 if (svn_err__temp) \ 00339 return svn_error_trace(svn_err__temp); \ 00340 } while (0) 00341 00342 /** 00343 * A macro for wrapping an error in a source-location trace message. 00344 * 00345 * This macro can be used when directly returning an already created 00346 * error (when not using SVN_ERR, svn_error_create(), etc.) to ensure 00347 * that the call stack is recorded correctly. 00348 * 00349 * @since New in 1.7. 00350 */ 00351 #ifdef SVN_ERR__TRACING 00352 svn_error_t * 00353 svn_error__trace(const char *file, long line, svn_error_t *err); 00354 00355 #define svn_error_trace(expr) svn_error__trace(__FILE__, __LINE__, (expr)) 00356 #else 00357 #define svn_error_trace(expr) (expr) 00358 #endif 00359 00360 /** 00361 * Returns an error chain that is based on @a err's error chain but 00362 * does not include any error tracing placeholders. @a err is not 00363 * modified, except for any allocations using its pool. 00364 * 00365 * The returned error chain is allocated from @a err's pool and shares 00366 * its message and source filename character arrays. The returned 00367 * error chain should *not* be cleared because it is not a fully 00368 * fledged error chain, only clearing @a err should be done to clear 00369 * the returned error chain. If @a err is cleared, then the returned 00370 * error chain is unusable. 00371 * 00372 * @a err can be #SVN_NO_ERROR. If @a err is not #SVN_NO_ERROR, then 00373 * the last link in the error chain must be a non-tracing error, i.e, 00374 * a real error. 00375 * 00376 * @since New in 1.7. 00377 */ 00378 svn_error_t *svn_error_purge_tracing(svn_error_t *err); 00379 00380 00381 /** A statement macro, very similar to @c SVN_ERR. 00382 * 00383 * This macro will wrap the error with the specified text before 00384 * returning the error. 00385 */ 00386 #define SVN_ERR_W(expr, wrap_msg) \ 00387 do { \ 00388 svn_error_t *svn_err__temp = (expr); \ 00389 if (svn_err__temp) \ 00390 return svn_error_quick_wrap(svn_err__temp, wrap_msg); \ 00391 } while (0) 00392 00393 00394 /** A statement macro intended for the main() function of the 'svn' program. 00395 * 00396 * Evaluate @a expr. If it yields an error, display the error on stdout 00397 * and return @c EXIT_FAILURE. 00398 * 00399 * @note Not for use in the library, as it prints to stderr. This macro 00400 * no longer suits the needs of the 'svn' program, and is not generally 00401 * suitable for third-party use as it assumes the program name is 'svn'. 00402 * 00403 * @deprecated Provided for backward compatibility with the 1.8 API. Consider 00404 * using svn_handle_error2() or svn_cmdline_handle_exit_error() instead. 00405 */ 00406 #define SVN_INT_ERR(expr) \ 00407 do { \ 00408 svn_error_t *svn_err__temp = (expr); \ 00409 if (svn_err__temp) { \ 00410 svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: "); \ 00411 svn_error_clear(svn_err__temp); \ 00412 return EXIT_FAILURE; } \ 00413 } while (0) 00414 00415 /** @} */ 00416 00417 00418 /** Error groups 00419 * 00420 * @defgroup svn_error_error_groups Error groups 00421 * @{ 00422 */ 00423 00424 /** 00425 * Return TRUE if @a err is an error specifically related to locking a 00426 * path in the repository, FALSE otherwise. 00427 * 00428 * SVN_ERR_FS_OUT_OF_DATE and SVN_ERR_FS_NOT_FOUND are in here because it's a 00429 * non-fatal error that can be thrown when attempting to lock an item. 00430 * 00431 * @since New in 1.2. 00432 */ 00433 #define SVN_ERR_IS_LOCK_ERROR(err) \ 00434 (err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \ 00435 err->apr_err == SVN_ERR_FS_NOT_FOUND || \ 00436 err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \ 00437 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN) 00438 00439 /** 00440 * Return TRUE if @a err is an error specifically related to unlocking 00441 * a path in the repository, FALSE otherwise. 00442 * 00443 * @since New in 1.2. 00444 */ 00445 #define SVN_ERR_IS_UNLOCK_ERROR(err) \ 00446 (err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED || \ 00447 err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \ 00448 err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \ 00449 err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \ 00450 err->apr_err == SVN_ERR_RA_NOT_LOCKED || \ 00451 err->apr_err == SVN_ERR_FS_LOCK_EXPIRED) 00452 00453 /** Evaluates to @c TRUE iff @a apr_err (of type apr_status_t) is in the given 00454 * @a category, which should be one of the @c SVN_ERR_*_CATEGORY_START 00455 * constants. 00456 * 00457 * @since New in 1.7. 00458 */ 00459 #define SVN_ERROR_IN_CATEGORY(apr_err, category) \ 00460 ((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE) 00461 00462 00463 /** @} */ 00464 00465 00466 /** Internal malfunctions and assertions 00467 * 00468 * @defgroup svn_error_malfunction_assertion Malfunctions and assertions 00469 * @{ 00470 */ 00471 00472 /** Report that an internal malfunction has occurred, and possibly terminate 00473 * the program. 00474 * 00475 * Act as determined by the current "malfunction handler" which may have 00476 * been specified by a call to svn_error_set_malfunction_handler() or else 00477 * is the default handler as specified in that function's documentation. If 00478 * the malfunction handler returns, then cause the function using this macro 00479 * to return the error object that it generated. 00480 * 00481 * @note The intended use of this macro is where execution reaches a point 00482 * that cannot possibly be reached unless there is a bug in the program. 00483 * 00484 * @since New in 1.6. 00485 */ 00486 #define SVN_ERR_MALFUNCTION() \ 00487 do { \ 00488 return svn_error_trace(svn_error__malfunction( \ 00489 TRUE, __FILE__, __LINE__, NULL)); \ 00490 } while (0) 00491 00492 /** Similar to SVN_ERR_MALFUNCTION(), but without the option of returning 00493 * an error to the calling function. 00494 * 00495 * If possible you should use SVN_ERR_MALFUNCTION() instead. 00496 * 00497 * @since New in 1.6. 00498 */ 00499 #define SVN_ERR_MALFUNCTION_NO_RETURN() \ 00500 do { \ 00501 svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \ 00502 abort(); \ 00503 } while (1) 00504 00505 /** Like SVN_ERR_ASSERT(), but append ERR to the returned error chain. 00506 * 00507 * If EXPR is false, return a malfunction error whose chain includes ERR. 00508 * If EXPR is true, do nothing. (In particular, this does not clear ERR.) 00509 * 00510 * Types: (svn_boolean_t expr, svn_error_t *err) 00511 * 00512 * @since New in 1.8. 00513 */ 00514 #ifdef __clang_analyzer__ 00515 #include <assert.h> 00516 /* Just ignore ERR. If the assert triggers, it'll be our least concern. */ 00517 #define SVN_ERR_ASSERT_E(expr, err) assert((expr)) 00518 #else 00519 #define SVN_ERR_ASSERT_E(expr, err) \ 00520 do { \ 00521 if (!(expr)) { \ 00522 return svn_error_compose_create( \ 00523 svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \ 00524 (err)); \ 00525 } \ 00526 } while (0) 00527 #endif 00528 00529 00530 /** Check that a condition is true: if not, report an error and possibly 00531 * terminate the program. 00532 * 00533 * If the Boolean expression @a expr is true, do nothing. Otherwise, 00534 * act as determined by the current "malfunction handler" which may have 00535 * been specified by a call to svn_error_set_malfunction_handler() or else 00536 * is the default handler as specified in that function's documentation. If 00537 * the malfunction handler returns, then cause the function using this macro 00538 * to return the error object that it generated. 00539 * 00540 * @note The intended use of this macro is to check a condition that cannot 00541 * possibly be false unless there is a bug in the program. 00542 * 00543 * @note The condition to be checked should not be computationally expensive 00544 * if it is reached often, as, unlike traditional "assert" statements, the 00545 * evaluation of this expression is not compiled out in release-mode builds. 00546 * 00547 * @since New in 1.6. 00548 * 00549 * @see SVN_ERR_ASSERT_E() 00550 */ 00551 #ifdef __clang_analyzer__ 00552 #include <assert.h> 00553 #define SVN_ERR_ASSERT(expr) assert((expr)) 00554 #else 00555 #define SVN_ERR_ASSERT(expr) \ 00556 do { \ 00557 if (!(expr)) \ 00558 SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \ 00559 } while (0) 00560 #endif 00561 00562 /** Similar to SVN_ERR_ASSERT(), but without the option of returning 00563 * an error to the calling function. 00564 * 00565 * If possible you should use SVN_ERR_ASSERT() instead. 00566 * 00567 * @since New in 1.6. 00568 */ 00569 #define SVN_ERR_ASSERT_NO_RETURN(expr) \ 00570 do { \ 00571 if (!(expr)) { \ 00572 svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \ 00573 abort(); \ 00574 } \ 00575 } while (0) 00576 00577 /** Report a "Not implemented" malfunction. Internal use only. */ 00578 #define SVN__NOT_IMPLEMENTED() \ 00579 return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.") 00580 00581 /** A helper function for the macros that report malfunctions. Handle a 00582 * malfunction by calling the current "malfunction handler" which may have 00583 * been specified by a call to svn_error_set_malfunction_handler() or else 00584 * is the default handler as specified in that function's documentation. 00585 * 00586 * Pass all of the parameters to the handler. The error occurred in the 00587 * source file @a file at line @a line, and was an assertion failure of the 00588 * expression @a expr, or, if @a expr is null, an unconditional error. 00589 * 00590 * If @a can_return is true, the handler can return an error object 00591 * that is returned by the caller. If @a can_return is false the 00592 * method should never return. (The caller will call abort()) 00593 * 00594 * @since New in 1.6. 00595 */ 00596 svn_error_t * 00597 svn_error__malfunction(svn_boolean_t can_return, 00598 const char *file, 00599 int line, 00600 const char *expr); 00601 00602 /** A type of function that handles an assertion failure or other internal 00603 * malfunction detected within the Subversion libraries. 00604 * 00605 * The error occurred in the source file @a file at line @a line, and was an 00606 * assertion failure of the expression @a expr, or, if @a expr is null, an 00607 * unconditional error. 00608 * 00609 * If @a can_return is false a function of this type must never return. 00610 * 00611 * If @a can_return is true a function of this type must do one of: 00612 * - Return an error object describing the error, using an error code in 00613 * the category SVN_ERR_MALFUNC_CATEGORY_START. 00614 * - Never return. 00615 * 00616 * The function may alter its behaviour according to compile-time 00617 * and run-time and even interactive conditions. 00618 * 00619 * @see SVN_ERROR_IN_CATEGORY() 00620 * 00621 * @since New in 1.6. 00622 */ 00623 typedef svn_error_t *(*svn_error_malfunction_handler_t) 00624 (svn_boolean_t can_return, const char *file, int line, const char *expr); 00625 00626 /** Cause subsequent malfunctions to be handled by @a func. 00627 * Return the handler that was previously in effect. 00628 * 00629 * @a func may not be null. 00630 * 00631 * @note The default handler is svn_error_abort_on_malfunction(). 00632 * 00633 * @note This function must be called in a single-threaded context. 00634 * 00635 * @since New in 1.6. 00636 */ 00637 svn_error_malfunction_handler_t 00638 svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func); 00639 00640 /** Return the malfunction handler that is currently in effect. 00641 * @since New in 1.9. */ 00642 svn_error_malfunction_handler_t 00643 svn_error_get_malfunction_handler(void); 00644 00645 /** Handle a malfunction by returning an error object that describes it. 00646 * 00647 * When @a can_return is false, abort() 00648 * 00649 * This function implements @c svn_error_malfunction_handler_t. 00650 * 00651 * @since New in 1.6. 00652 */ 00653 svn_error_t * 00654 svn_error_raise_on_malfunction(svn_boolean_t can_return, 00655 const char *file, 00656 int line, 00657 const char *expr); 00658 00659 /** Handle a malfunction by printing a message to stderr and aborting. 00660 * 00661 * This function implements @c svn_error_malfunction_handler_t. 00662 * 00663 * @since New in 1.6. 00664 */ 00665 svn_error_t * 00666 svn_error_abort_on_malfunction(svn_boolean_t can_return, 00667 const char *file, 00668 int line, 00669 const char *expr); 00670 00671 /** @} */ 00672 00673 00674 #ifdef __cplusplus 00675 } 00676 #endif /* __cplusplus */ 00677 00678 #endif /* SVN_ERROR_H */
1.4.7