Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-12 19:45:27

Hi Giovanni,

--- "Giovanni P. Deretta" <gpderetta_at_[hidden]> wrote:
> I've done exactly that in my network library (although it does
> support only synchronous behaviour). An optional error
> handler functor is passed to every functions that can generate
> an error. If no handler is passed a default handler is used
> that converts errors in exceptions. It works quite well. The
> user need to explicitly check for errors only if it wants to,
> else exceptions are used.

In fact asio uses what sounds like exactly the same approach
for the synchronous functions. E.g.

  sock.write_some(bufs, asio::throw_error());

  sock.write_some(bufs, asio::ignore_error());

  asio::error error;
  sock.write_some(bufs, asio::assign_error(error));

  sock.write_some(bufs, custom_error_handler);

The default is also to convert the error into an exception.


Boost list run by bdawes at, gregod at, cpdaniel at, john at