2

For example, in cppreference.com, it says operator>>(std::basic_string) can throw exceptions on these conditions.

  1. may throw std::ios_base::failure if no characters are extracted from is (e.g the stream is at end of file, or consists of whitespace only), or if an exception is thrown during input.

But how can I know what really cause that exception, like ENOMEM, EINTR in C style errno? Does std::ios_base::failure::what and std::ios_base::failure::code tell me that? If it is, where can I find documentation about what exact error code is set in what exact situation? For instance, I want something like POSIX documentation on scanf, which contains a list of error numbers and corresponding error conditions.

kjh6b6a68
  • 499
  • 2
  • 8
  • 2
    Does this [answer](https://stackoverflow.com/a/562465/15559606) help? Otherwise you can just use `std::exception::what` which describes the exception. There also exists `typeid(exc).name()` but it's platform specific – Offtkp Dec 18 '21 at 09:00

0 Answers0