Missing failure checks in HDF5
There is around one hundred checks of the type dolfin_assert(foo != HDF5_FAIL)
. That's not fair for users having asserts off not to be caught on an error condition.
I remind that asserts are exclusively for checking consistency in our library, i.e. a condition which should always be true. They should not be used for checking correctness of user input or error conditions which can happen.
Comments (7)
-
-
Agree on
dolfin_error
having too many arguments. It's tedious to use. -
Use a macro like this https://bitbucket.org/fenics-project/dolfin/src/0aa8af18ff46ddcaec22db1cc927c4f5fc88813c/dolfin/la/PETScVector.cpp?at=master&fileviewer=file-view-default#PETScVector.cpp-44 and you can get file and line automatically without having to type it out.
-
Macros are generally (and rightly) considered evil... but I could be persuaded.
-
It's often not important where an error is raised, e.g. if trying to open a file that doesn't exist the most helpful message is a short one that says the file does not exist.
-
@michalhabera will look into using HDF5's own error handler to produce error reports.
-
-
assigned issue to
-
assigned issue to
- Log in to comment
We need a shorter one-line
dolfin_error
to avoid cluttering the code with error checks. Agree otherwise.