Author: rhuijben Date: Mon Aug 8 15:06:28 2011 New Revision: 1154982 URL: http://svn.apache.org/viewvc?rev=1154982&view=rev Log: In ra_serf: Never return APR_EGENERAL to callers as thas makes it impossible for applications to even guess what went wrong, and hard for us to fix the problems that cause this error
* subversion/libsvn_ra_serf/merge.c (end_merge): Use the generic request failed error. * subversion/libsvn_ra_serf/serf.c (svn_ra_serf__get_uuid): Return a real error code. * subversion/libsvn_ra_serf/util.c (start_error): Use SVN_ERR_RA_DAV_REQUEST_FAILED as default error code instead of the generic apr error. (handle_response): Don't try to parse the text of a http 405 error as xml and provide a slightly better error than "Unspecified error message" which at least tells us which request failed. Modified: subversion/trunk/subversion/libsvn_ra_serf/merge.c subversion/trunk/subversion/libsvn_ra_serf/serf.c subversion/trunk/subversion/libsvn_ra_serf/util.c Modified: subversion/trunk/subversion/libsvn_ra_serf/merge.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/merge.c?rev=1154982&r1=1154981&r2=1154982&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/merge.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/merge.c Mon Aug 8 15:06:28 2011 @@ -294,8 +294,7 @@ end_merge(svn_ra_serf__xml_parser_t *par href = apr_hash_get(info->props, "href", APR_HASH_KEY_STRING); if (! svn_urlpath__is_ancestor(ctx->merge_url, href)) { - /* ### need something better than APR_EGENERAL */ - return svn_error_createf(APR_EGENERAL, NULL, + return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL, _("A MERGE response for '%s' is not " "a child of the destination ('%s')"), href, ctx->merge_url); Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1154982&r1=1154981&r2=1154982&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Mon Aug 8 15:06:28 2011 @@ -1110,7 +1110,7 @@ svn_ra_serf__get_uuid(svn_ra_session_t * SVN_ERR(svn_ra_serf__discover_vcc(&vcc_url, session, NULL, pool)); if (!session->uuid) { - return svn_error_create(APR_EGENERAL, NULL, + return svn_error_create(SVN_ERR_RA_DAV_RESPONSE_HEADER_BADNESS, NULL, _("The UUID property was not found on the " "resource or any of its parents")); } Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1154982&r1=1154981&r2=1154982&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_ra_serf/util.c (original) +++ subversion/trunk/subversion/libsvn_ra_serf/util.c Mon Aug 8 15:06:28 2011 @@ -821,7 +821,7 @@ start_error(svn_ra_serf__xml_parser_t *p } else { - ctx->error->apr_err = APR_EGENERAL; + ctx->error->apr_err = SVN_ERR_RA_DAV_REQUEST_FAILED; } /* Start collecting cdata. */ @@ -2013,17 +2013,19 @@ handle_response(serf_request_t *request, ctx->conn->last_status_code = sl.code; - if (sl.code == 409 || sl.code >= 500) + if (sl.code == 405 || sl.code == 409 || sl.code >= 500) { - /* 409 Conflict: can indicate a hook error. + /* 405 Method Not allowed. + 409 Conflict: can indicate a hook error. 5xx (Internal) Server error. */ SVN_ERR(svn_ra_serf__handle_server_error(request, response, pool)); if (!ctx->session->pending_error) { return - svn_error_createf(APR_EGENERAL, NULL, - _("Unspecified error message: %d %s"), sl.code, sl.reason); + svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL, + _("The %s request on '%s' failed: %d %s"), + ctx->method, ctx->path, sl.code, sl.reason); } return SVN_NO_ERROR; /* Error is set in caller */