Skip to content

Replace asserts with throw std::runtime_error when appropriate

Tammo Jan Dijkema requested to merge replace-asserts into master

Created by: aroffringa

Pull request to finish #1 (closed). I think the rule should be that any error caused by bad input (parset error, command line error, data format error, etc) should throw an exception. Any check on internal consistency or logic can be an assert(), so that they are disabled when building in RELEASE mode. Some of the e.g. parset errors are now checked with 'assert', which means that they won't be checked when build in RELEASE mode. Moreover, an assert error is not very helpful for the user, an exception is at least a slightly friendlier description of the problem.

Merge request reports