OPENDAP / hdf5_handler

BES module to read hdf5 files
GNU Lesser General Public License v2.1
6 stars 3 forks source link

Catch BESError in HDF5RequestHandler dap methods. #15

Closed ndp-opendap closed 4 years ago

ndp-opendap commented 4 years ago

This branch fixes the following issue. In the HDF5RequestHandler the DAP response methods utilize a top level try block and the following catch pattern:

    catch(InternalErr & e) {
        throw BESDapError(e.get_error_message(), true, e.get_error_code(),
                       __FILE__, __LINE__);
    }
    catch(Error & e) {
        throw BESDapError(e.get_error_message(), false, e.get_error_code(),
                       __FILE__, __LINE__);
    }
    catch(...) {
        string s = "unknown exception caught building HDF5 DataDDS";
        throw BESInternalFatalError(s, __FILE__, __LINE__);
    }

This is problematic because the code being run throws various children of BESError, these errors are being swept up in the (...) clause and turned into BESInternalFatalErrors even when they are not fatal errors. Adding this solves the problem nicely:

    catch(BESError & e) {
        BESDEBUG(HDF5_NAME, "Caught BESError! Message: " << e.get_message() << endl);
        throw;
    }

The affected methods are:

jgallagher59701 commented 4 years ago

OK, merge this. But see my PR on libdap that affects libdap::Error and the file/line info.