Skip to content

tom-010/exception-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safe

This is quite a simple package. It catches all exceptions within a given callable and returns None, if they occur and the return-value of the callable if not.

def boom():
    raise Exception()
    return 1

def non_boom():
    return 2

a = safe(lambda: boom())
b = safe(lambda: non_boom())

assert a == None
assert b == 2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published