30 Input/output library [input.output]

30.5 Iostreams base classes [iostreams.base]

30.5.3 Class ios_­base [ios.base]

30.5.3.1 Types [ios.types]

30.5.3.1.1 Class ios_­base​::​failure [ios::failure]

namespace std {
  class ios_base::failure : public system_error {
  public:
    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
    explicit failure(const char* msg, const error_code& ec = io_errc::stream);
  };
}
An implementation is permitted to define ios_­base​::​failure as a synonym for a class with equivalent functionality to class ios_­base​::​failure shown in this subclause.
[Note
:
When ios_­base​::​failure is a synonym for another type it shall provide a nested type failure, to emulate the injected class name.
end note
]
The class failure defines the base class for the types of all objects thrown as exceptions, by functions in the iostreams library, to report errors detected during stream buffer operations.
When throwing ios_­base​::​failure exceptions, implementations should provide values of ec that identify the specific reason for the failure.
[Note
:
Errors arising from the operating system would typically be reported as system_­category() errors with an error value of the error number reported by the operating system.
Errors arising from within the stream library would typically be reported as error_­code(io_­errc​::​stream, iostream_­category()).
end note
]
explicit failure(const string& msg, const error_code& ec = io_errc::stream);
Effects: Constructs an object of class failure by constructing the base class with msg and ec.
explicit failure(const char* msg, const error_code& ec = io_errc::stream);
Effects: Constructs an object of class failure by constructing the base class with msg and ec.