Re: Detecting unhandled errors
From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2003-10-11 15:27:50 CEST
"Sander Striker" <striker@apache.org> writes:
> > > * This will catch errors dropped by applications as well as errors we
This is exactly what I was about to do (except, using
-- * subversion/libsvn_subr/error.c (err_abort): New. (make_error_internal): Register err_abort() as a cleanup routine for new error pools. (svn_error_clear, svn_error_compose): Remove err_abort() from the cleanup routine list on the error's pool. Index: subversion/libsvn_subr/error.c =================================================================== --- subversion/libsvn_subr/error.c (revision 7373) +++ subversion/libsvn_subr/error.c (working copy) @@ -61,6 +61,14 @@ } +/* Cleanup function for errors. svn_error_clear () removes this so + errors that are properly handled *don't* hit this code. */ +static apr_status_t err_abort (void *data) +{ + abort(); +} + + static svn_error_t * make_error_internal (apr_status_t apr_err, svn_error_t *child) @@ -71,8 +79,12 @@ /* Reuse the child's pool, or create our own. */ if (child) pool = child->pool; - else if (apr_pool_create (&pool, NULL)) - abort (); + else + { + if (apr_pool_create (&pool, NULL)) + abort (); + apr_pool_cleanup_register(pool, NULL, err_abort, NULL); + } /* Create the new error structure */ new_error = (svn_error_t *) apr_pcalloc (pool, sizeof (*new_error)); @@ -157,6 +169,7 @@ } /* Destroy the new error chain. */ + apr_pool_cleanup_kill (oldpool, NULL, err_abort); apr_pool_destroy (oldpool); } @@ -165,7 +178,10 @@ svn_error_clear (svn_error_t *err) { if (err) - apr_pool_destroy (err->pool); + { + apr_pool_cleanup_kill (err->pool, NULL, err_abort); + apr_pool_destroy (err->pool); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org For additional commands, e-mail: dev-help@subversion.tigris.orgReceived on Sat Oct 11 15:28:56 2003 |
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.