[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Augment the awful "200 OK" error message when can't connect to repository

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Fri, 08 Jan 2010 13:22:53 +0000

What happens if I accidentally specify a URL that's not a repository?
(Recent trunk build, Neon.)

> $ svn checkout https://svn.apache.org/repos/
> svn: OPTIONS of 'https://svn.apache.org/repos': 200 OK (https://svn.apache.org)

This is a truly awful error message, appearing alone as it does. Google
reveals that many users have spent hours trying to track down the cause
of such errors. They appear in all repository operations, not just
checkout. For example,
<http://forum.joomla.org/viewtopic.php?f=406&t=205587> (during import;
unresolved) and
<http://stackoverflow.com/questions/1025377/an-svn-error-200-ok-when-checking-out-from-my-online-repo> (during checkout; SSH credentials not provided).

What do we need to do? Two things, I think:

  1. That low-level error report needs to be better. Any low-level
function that regards a "200 OK" response as an error must not just
create an error object saying "200 OK" alone but must wrap or replace
that with an error message that indicates what it was trying to do and
why an "OK" response is wrong.

  2. Each high level operation should aim to wrap any error from a
low-level function call with a higher-level explanation. For example,
"checkout" subcommand should wrap any error with "failed to check out
URL 'xxx'". It should not assume the low-level error provides enough
information. It should mention the high-level object (e.g. path or URL)
that failed so that the user can distinguish it within a batch of mostly
successful attempts.

The attached patch implements an instance of (2.) at the level of
connecting to a repository - svn_ra_open3(). It expands the above quoted
error to:

> $ svn checkout https://svn.apache.org/repos/
> svn: Unable to connect to a repository at URL 'https://svn.apache.org/repos'
> svn: OPTIONS of 'https://svn.apache.org/repos': 200 OK (https://svn.apache.org)

The corresponding errors with svn: and file: URLs are then:

> $ svn checkout svn://localhost/repos
> svn: Unable to connect to a repository at URL 'svn://localhost/repos'
> svn: Can't connect to host 'localhost': Connection refused

> $ svn checkout file://localhost/repos
> svn: Unable to connect to a repository at URL 'file://localhost/repos'
> svn: Unable to open an ra_local session to URL
> svn: Unable to open repository 'file://localhost/repos'

There is now a little redundancy in the RA-local error. I think that is
acceptable and overall better than the previous situation.

It passes tests. I'll comit in a day or two if no objections.

- Julian

Received on 2010-01-08 14:23:33 CET

This is an archived mail posted to the Subversion Dev mailing list.