Boost C++ Libraries

PrevUpHomeNext

Class system_error

boost::process::system_error — Run time error initiated in a system call.

Synopsis

class system_error {
public:
  // types
  typedef NativeErrorCodeType code_type;  // Native type used by the system to report error codes. 

  // construct/copy/destruct
  system_error(const std::string &, const std::string &, code_type);
  ~system_error(void);

  // public member functions
  code_type code(void) const;
  const char * what(void) const;
};

Description

The system_error exception wraps the information generated by an operating system error. These errors are the result of incorrect or erroneous system calls.

system_error construct/copy/destruct

  1. system_error(const std::string & who, const std::string & message, 
                 code_type sys_err);

    Constructs a new exception based on the result of an incorrect or an erroneous system call.

    Parameters:
    message

    String that describes the error that occurred (typically the system call that failed).

    sys_err

    The system error code that identifies the error. On a POSIX system this is the value of errno and on a Win32 system it is the value returned by GetLastError().

    who

    String that indicates the class and function where the error was first detected.

  2. ~system_error(void );

    Virtual destructor. Does nothing special but is required because of the parent's class destructor.

system_error public member functions

  1. code_type code(void ) const;

    Returns the exception's native error code; that is, the value provided by the operating system when it reported the error.

  2. const char * what(void ) const;

    Generates and returns a formatted error message for the native error code attached to this exception. This includes the function that raised the error, the system call where it was initiated and the reason for the failure. The last is determined by strerror() in POSIX systems and FormatMessage under Win32.

    Returns:

    A constant C string containing the formatted error message. The caller must not release it.

Copyright © 2006 Julio M. Merino Vidal

PrevUpHomeNext