- changed status to open
- removed comment
use catch/throw in LORENE ID thorns to report file-open failures
the LORENE classes Bin_NS/Bin_BH/Mag_NS do not check for errors in fopen and simply pass the returned file hanlde to fread. If one enters the wrong filename in parameter files this causes a segfault. The attached patches add a patch to ExternalLibraries/LORENE to check for the error condition and throw ios_base::failure(sterror(errno)) upon error. The ID thorns catch this exception.
My main questions is whether we are happy with this kind of error handling using C++ exceptions (which requires very little code change) or would rather have the LORENE classes themselves spit out the error message (and abort()). Notice that the error happens in a constructor so I cannot simply return an error code from the LORENE function.
Keyword:
Comments (3)
-
reporter -
- removed comment
Using C++ exceptions should be fine. You may want to check that they are supported (by the compiler, and by Simfactory's options) on the relevant systems; some HPC systems are quite weird (e.g. Blue Gene/P does not support symbolic links).
(I would have added a "#include <cctk.h>", and then called CCTK_WARN to abort.)
Your patch disables a "rm -rf", probably unintentionally.
The patch is fine, please apply.
-
reporter - changed status to resolved
- removed comment
all applied.
- Log in to comment