Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error/message handling in Tudat #38

Closed
magnific0 opened this issue Jun 1, 2016 · 2 comments
Closed

Error/message handling in Tudat #38

magnific0 opened this issue Jun 1, 2016 · 2 comments

Comments

@magnific0
Copy link
Member

I noticed that handling of errors, warning and notifications in Tudat is not uniform at all. I did a quick analysis and found the following

182 throw std::runtime_error
96 std::cerr: for warning (none throw exceptions)
89 boost::throw_exception
4 assert
3 BOOST_THROW_EXCEPTION
2 throw("messsage")
1 std::cout: notification purposes.

We also have
52 catch (50 in unit tests, 2 outised)

I think we should discuss where we stand on issuing warnings (cerr, none are followed by a throw) and notices (cout). Especially in recent code these are more common. Warning can be made errors of course and I think should if the result is an immidiate crash. I see no justification for asserts.

Also it seems boost exception throwing makes up for roughly a third. Do we need boost or can we suffice with std?

Perhaps we can write at least some guidelines on this on the wiki and perhaps make the code uniform. Overal, Tudat could do with a bit more checks and sanitization, but this is perhaps topic for a future discussion.

@DominicDirkx
Copy link
Member

In the latest update, we have significantly improved the consistency of the error messages. Cerr message are now only used for warnings, boost and std exceptions are still mixed, however

@DominicDirkx
Copy link
Member

Hi Jacco,

I've largely homogenized the exception handling: with one exception (the ConvergenceException class) all boost exceptions and assert statements have been removed.

All real errors are now handled by std::runtime_error (a total of 741 times). Warnings, which users should be aware of, but should not terminate the propagtion, are handled by std::cerr statements and, for a few rare cases, simple messages to the user are given by std::cout statements.

A pull request has been opened: #213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants