DiODeProject / MuMoT

Multiscale Modelling Tool - mathematical modelling without the maths
https://mumot.readthedocs.io/
GNU General Public License v3.0
21 stars 5 forks source link

Clean exceptions #352

Open joefresna opened 5 years ago

joefresna commented 5 years ago

Exceptions, such as warnings and errors, are sometimes raised with a print("Warning message"). They should instead be raised with raise exceptions.MuMoTWarning("Warning message")

joefresna commented 5 years ago

Created branch for this, named clean-exceptions. The commit https://github.com/DiODeProject/MuMoT/commit/f1d090ba1ef40357fddcd4114a26c66b9b3601b6 of that branch cleaned the part of stochastic analysis. Other views and models have still some print()

jarmarshall commented 5 years ago

(quoted from #318)

I changed my old print("Warning message") with raise exceptions.MuMoTWarning("Warning message") (as indicated in #352), however this stops the program. Instead, the desired behaviour is to let it keep running and just print the warning message. How shall I do that? Do you know, @jarmarshall ?

I think you can use warn() from the warnings module...

jarmarshall commented 5 years ago

PS some warnings should go to the log, some should probably be displayed. Most probably should go to the log - so need to pay attention to this...