Boost logo

Boost :

From: davlet_panech (davlet_panech_at_[hidden])
Date: 2002-02-21 19:24:59


Hi,

Is there any any interest in a runtime_error subclass constructible
from an errno value, such that the description returned by `what()'
is created using a call to strerror()? I think such class could be
useful for at least some of the existing boost libraries, such as
Boost.Threads, or the Socket library (which doesn't exist yet, but
still):

class sys_error: public std::runtime_error {
public:
  sys_error( const std::string &s ): runtime_error( s )
  {
  }
};

class specfic_sys_error: public sys_error
{
public:

  // Pass strerror( errno ) to base class ctor
  specific_sys_error();
    
  // Pass strerror( errno_val ) to base ctor
  specific_sys_error( int errno_val );

  // Create error description "perror-style", i.e.,
  // details << ": " << strerror( errno );
  template< class T >
  specific_sys_error( const T &details, int errno )

};

// Possibly a few subclasses at least for some
// of the errno values (ENOENT & EACCESS are good
// candidates IMHO).

Thanks,
D.P.


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