title: Why does C++'s exception not provide the calling details?
body: <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  
  int main(int argc, char** argv) {
      try {
          std::map&lt;std::string, int&gt; m{{"a", 1}, {"b", 2}};
          std::cout &lt;&lt; m.at("c") &lt;&lt; std::endl;
      } catch (const std::exception&amp; e) {
          std::cerr &lt;&lt; e.what() &lt;&lt; std::endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>In C++, when retrieving a non-existent key of a map, the exception looks like <code>map::at:  key not found</code>. Information about what the <em>key</em> is is not provided. </p>
  
  <p>Also, if one is accessing a non-existent file, the exception message of <code>std::ios_base::failure</code> looks like <code>ios_base::clear: unspecified iostream_category error</code>. The <em>filename</em> which caused the exception is not provided. Thus it may take quite a time to find out where the exception is from if there are many <code>map.at()</code> or <code>ifstream is</code> uses in a project. </p>
  
  <p>In contrast to this, Python may tell you <code>KeyError: 'c'</code> or <code>FileNotFoundError: [Errno 2] No such file or directory: 'foo'</code>.</p>
  
  <p>Is this just a C++ convention? Thank you.</p>