You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/06/24 19:40:22 UTC

svn commit: r1496132 - /subversion/trunk/subversion/libsvn_ra_serf/serf.c

Author: rhuijben
Date: Mon Jun 24 17:40:21 2013
New Revision: 1496132

URL: http://svn.apache.org/r1496132
Log:
Provide a slightly more detectable error code than APR_EGENERAL when a
connection fails on opening an ra session.

The combination serf/apr should really provide the error stored
for the connection (in the sockopt SO_ERROR) instead of this catch all error,
to allow users and clients access to more detailed diagnosis.

* subversion/libsvn_ra_serf/serf.c
  (svn_ra_serf__open): Wrap APR_EGENERAL with an error that is diagnosable
    from code as being network related.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/serf.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1496132&r1=1496131&r2=1496132&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Mon Jun 24 17:40:21 2013
@@ -392,6 +392,7 @@ svn_ra_serf__open(svn_ra_session_t *sess
   svn_ra_serf__session_t *serf_sess;
   apr_uri_t url;
   const char *client_string = NULL;
+  svn_error_t *err;
 
   if (corrected_url)
     *corrected_url = NULL;
@@ -479,7 +480,14 @@ svn_ra_serf__open(svn_ra_session_t *sess
 
   session->priv = serf_sess;
 
-  return svn_ra_serf__exchange_capabilities(serf_sess, corrected_url, pool);
+  err = svn_ra_serf__exchange_capabilities(serf_sess, corrected_url, pool);
+
+  /* serf should produce a usable error code instead of EGENERAL */
+  if (err->apr_err == APR_EGENERAL)
+    err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, err,
+                            _("Connection to '%s' failed"), session_URL);
+
+  return svn_error_trace(err);
 }
 
 /* Implements svn_ra__vtable_t.reparent(). */