centreformicrosimulation / SimPaths

SimPaths is an open-source microsimulation framework for life course analysis, developed and maintained by CeMPA at the University of Essex
European Union Public License 1.2
7 stars 17 forks source link

Bugfix/catch tax errors #40

Closed andrewbaxter439 closed 12 months ago

andrewbaxter439 commented 1 year ago

Minor additional tweak - the checks throwing RuntimeExceptions in KeyFunction were not being caught and leaving run in suspense. https://github.com/centreformicrosimulation/SimPaths/blob/2909099624042b85b1723d044ada3328bc6cc00b/src/main/java/simpaths/model/taxes/KeyFunction.java#L44-L47

The proposed changes add try/catch statements and exit the run if these errors are thrown.

andrewbaxter439 commented 12 months ago

Hi @pbronka - had started this draft PR but wanted to hold off on submitting it until #37 is resolved as I've included multiple of the same commits and need to tidy this up. If the headless setup and github runs branch seems to be working and mergeable I can work on this one this week? It's a minor thing but would want to suggest it as a failsafe.

andrewbaxter439 commented 12 months ago

to note - only the last two commits here belong to this branch specifically, but I built this on top of experimental/headless_setup and need to test it/tidy it up if the other one gets merged! Thanks.

andrewbaxter439 commented 12 months ago

These try/catch statements should work to exit the run when it fails. Had tested out by adding a throw new RuntimeException("Test error") to the KeyFunction constructor and seems to catch reliably in all cases. Hope it's helpful @pbronka!