Open Gronnesby opened 7 years ago
It appears that the e.what() is not being properly populated, hence an empty string is being printed. The exception refers to having an incorrect ncid value reported. This code was donated to Unidata, let me dig in and take a look to see if I can fix this up.
Hi, I'm pretty new to C++, so please let me know if I've got this wrong.
In the example files the catch-all exception handling looks something like this:
What I am wondering about is how do you actually get any useful information out of the exception handling? I've tried to read a NcFile into a map like so:
Which essentially prints garbage values:
An exception occured while reading a file: p�
If I remove the whole try-catch block and just don't handle the exception, i get this:
Any idea why the
e.what()
function only returns garbage values (the "p" seems to always crop up)? As per the documentation forstd::exception::what
it should return aconst char *
. Or have i completely misunderstood exception handling in C++?