phi-grib / flame

Modeling framework for eTRANSAFE project
GNU General Public License v3.0
12 stars 10 forks source link

Handling of exceptions #45

Closed BielStela closed 1 year ago

BielStela commented 6 years ago

Don't use:

try:
    1/0
except:
    print('something did not work')

will print something did not work

Always catch the exception (even with generic exception class Exception):

try:
    1/0
except Exception as e:
    print(f' something did not work. Cause: {e}')

will print something did not work. Cause: division by zero

Let's build a better world together