Skip to content

Instantly share code, notes, and snippets.

@tuulos
Created May 7, 2024 18:30
Show Gist options
  • Save tuulos/fd165242020606fc73095ad2308503af to your computer and use it in GitHub Desktop.
Save tuulos/fd165242020606fc73095ad2308503af to your computer and use it in GitHub Desktop.
from metaflow import FlowSpec, step
from functools import wraps
def log_to_sentry(x):
print('sentry', x)
def sentry_logger(f):
@wraps(f)
def func(self):
try:
f(self)
except Exception as x:
log_to_sentry(x)
raise
return func
class SentryFlow(FlowSpec):
@sentry_logger
@step
def start(self):
raise KeyError('foobar')
self.next(self.end)
@step
def end(self):
pass
if __name__ == '__main__':
SentryFlow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment