rlguy/GridFluidSim3D

Catch exceptions in main()?

elfring opened this issue · 2 comments

I expect that exception handling is usually supported by a C++ program. I wonder why your function "main" does not contain corresponding try and catch instructions so far.

How do you think about recommendations by Matthew Wilson in an article?

Would you like to adjust the implementation if you consider effects for uncaught/unhandled exceptions like they are described by Danny Kalev?

rlguy commented

Hello elfring,

Thanks for providing those links, they were interesting and I learned a few things!

I will be leaving the main function as it is. I meant for the main method to contain a simple example for how to use the FluidSimulation class and I would like to keep that method as uncluttered as possible. The user is free to add in exception/error handling when using the FluidSimulation class themselves.

I did modify the public methods in the FluidSimulation class to throw exceptions on invalid input instead of triggering assertions.

Best Regards,
Ryan