Boost logo

Boost :

Subject: Re: [boost] [ann] Urdl - a library for downloading web content
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2009-06-18 07:56:13


Ryan Gallagher wrote:
> After a brief look, one thing that wasn't obvious to me was why
> exactly the url constructor throws boost::system::system_error
> (other than performance of open). I can understand why you'd want
> the open functions to do so and are taking advantage of implicit
> conversion from std::string/char*. However, either letting them
> throw a std::runtime_error derived url_parsing_error exception or
> translating this exception to a system_error with an appropriate
> error_code makes more sense to me.

On reflection, adding new open() overloads that take std::string/char*
does sound better. That way the behaviour will be just like if you open
a std::ifstream with a bogus path.

> Also, what the specific error code would be for a url parsing error
> wasn't clear -- the constructor of url didn't document this from
> what I saw.

So far I was just lazy and used invalid_argument for all errors. Later I
intend to add more specific errors to give more information about what
was wrong with the URL.

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk