MuMoT icon indicating copy to clipboard operation
MuMoT copied to clipboard

Clean exceptions

Open joefresna opened this issue 6 years ago • 3 comments

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 avatar Sep 27 '19 11:09 joefresna

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()

joefresna avatar Sep 27 '19 11:09 joefresna

(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 avatar Sep 27 '19 13:09 jarmarshall

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...

jarmarshall avatar Sep 27 '19 14:09 jarmarshall