Skip to content

Instantly share code, notes, and snippets.

@stilobique
Created August 10, 2021 15:21
Show Gist options
  • Select an option

  • Save stilobique/3ddf91f57f4486e32ab64a7c05996bfd to your computer and use it in GitHub Desktop.

Select an option

Save stilobique/3ddf91f57f4486e32ab64a7c05996bfd to your computer and use it in GitHub Desktop.
Setup a dedicated exception
class ErrorTest(Exception):
""" A message about one error"""
pass
class ExceptTest(Exception):
""" A message about one error"""
pass
def simple_func(value):
try:
if value == 0:
raise ExceptTest
elif value == 1:
raise ErrorTest
else:
return True
except (ExceptTest, ErrorTest) as exception:
print(f'Error message : {exception.__doc__}')
return {'ERROR'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment