Skip to content

Instantly share code, notes, and snippets.

@goodwillcoding
Created January 7, 2013 07:28
Show Gist options
  • Save goodwillcoding/4473118 to your computer and use it in GitHub Desktop.
Save goodwillcoding/4473118 to your computer and use it in GitHub Desktop.
class FooError(Exception): pass
def public_api1(x):
"""
Return given value, after making sure it is not 1.
:param x: value:
:type x: int
:raises: ForError if x == 1
:return: x if not equal to 1
:rtype: int
"""
if x == 1:
raise FooError('x is 1')
return x
def public_api2(x):
"""
Return given value after adding 5 to it, unless x == 1.
:param x: value:
:type x: int
:raises: ForError if x == 1
:return: x if not equal to 1
:rtype: int
"""
# this may raise FooError
public_api1(x)
x = x + 5
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment