Last active
August 13, 2020 12:33
-
-
Save thepabloaguilar/2e1b61f2b83a64210f88c62d213cf4b3 to your computer and use it in GitHub Desktop.
[Article] Monkey Patching is not too bad - `collect_traces` example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from returns.result import Failure, Result | |
from returns.primitives.tracing import collect_traces | |
@collect_traces | |
def get_failure(argument: str) -> Result[str, str]: | |
return Failure(argument) | |
failure = get_failure('example') | |
for trace_line in failure.trace: | |
print(f"{trace_line.filename}:{trace_line.lineno} in `{trace_line.function}`") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment