#738: use catch/throw in LORENE ID thorns to report file-open failures -----------------------------------+---------------------------------------- Reporter: rhaas | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: EinsteinToolkit thorn | Version: Keywords: | -----------------------------------+---------------------------------------- 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.