Improve error reporting for ra_local access when permission problems
and/or other operating-system issues prevent access.
* subversion/include/svn_error_codes.h
(SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED): New error code. Distinguished
from SVN_ERR_RA_LOCAL_REPOS_NOT_FOUND in that the repository was found,
but could not be opened.
* subversion/include/svn_error.h
(svn_error_cause): Prototype and documentation for new function.
* subversion/libsvn_subr/svn_error.c
(svn_error_cause): New function.
* subversion/libsvn_ra_local/split_url.c
(svn_ra_local__split_URL): Inspect errors from svn_repos_open() rather
than presuming that an error indicates that the repos was not found.
Index: subversion/include/svn_error_codes.h
===================================================================
--- subversion/include/svn_error_codes.h
+++ subversion/include/svn_error_codes.h Fri Sep 13 09:44:31 2002
@@ -519,6 +519,10 @@
SVN_ERR_RA_LOCAL_CATEGORY_START + 0,
"Couldn't find a repository.")
+ SVN_ERRDEF (SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED,
+ SVN_ERR_RA_LOCAL_CATEGORY_START + 1,
+ "Couldn't open the repository.")
+
/* svndiff errors */
SVN_ERRDEF (SVN_ERR_SVNDIFF_INVALID_HEADER,
Index: subversion/include/svn_error.h
===================================================================
--- subversion/include/svn_error.h
+++ subversion/include/svn_error.h Fri Sep 13 09:46:03 2002
@@ -113,6 +113,10 @@
the last child error in CHAIN. */
void svn_error_compose (svn_error_t *chain, svn_error_t *new_err);
+/* Return the last child-error in CHAIN. This is presumably
+ the "cause" of the error. */
+svn_error_t *svn_error_cause (svn_error_t *chain);
+
/* Clear ERROR's pool. Note that this is likely the top-level error
pool shared with any other errors currently extant, though usually
Index: subversion/libsvn_subr/svn_error.c
===================================================================
--- subversion/libsvn_subr/svn_error.c
+++ subversion/libsvn_subr/svn_error.c Fri Sep 13 09:35:56 2002
@@ -304,6 +304,14 @@
chain->child = new_err;
}
+svn_error_t *
+svn_error_cause (svn_error_t *chain)
+{
+ while (chain->child)
+ chain = chain->child;
+
+ return chain;
+}
void
svn_error_clear_all (svn_error_t *err)
Index: subversion/libsvn_ra_local/split_url.c
===================================================================
--- subversion/libsvn_ra_local/split_url.c
+++ subversion/libsvn_ra_local/split_url.c Fri Sep 13 09:56:35 2002
@@ -104,6 +104,8 @@
the last component from the URL, then try again. */
while (1)
{
+ svn_error_t *cause;
+
/* Attempt to open a repository at URL. */
err = svn_repos_open (&repos, candidate_url, subpool);
@@ -111,6 +113,13 @@
if (err == SVN_NO_ERROR)
break;
+ cause = svn_error_cause (err);
+ if (cause && !APR_STATUS_IS_ENOENT(cause->apr_err))
+ return svn_error_createf
+ (SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, 0, err, pool,
+ "svn_ra_local__split_URL: Unable to open repository\n"
+ " (%s)", URL);
+
/* It would be strange indeed if "/" were a repository, but hey,
people do strange things sometimes. Anyway, if "/" failed
the test above, then reduce it to the empty string.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 13 16:51:30 2002