Skip to content

Commit

Permalink
use flag raise errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Weiss Bang committed Apr 7, 2021
1 parent 08425ae commit 1b4be39
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/codoc/entrypoints/cli.py
Expand Up @@ -50,6 +50,8 @@ def __init__(
self, path="codoc_views", report_errors=False, silent=False, raise_errors=False
):
self._path = path

self._raise_errors = raise_errors
if not silent:
logging.basicConfig(
format="%(message)s",
Expand All @@ -71,6 +73,8 @@ def publish(self):
except KeyboardInterrupt:
return "Manual exit"
except Exception as e:
if self._raise_errors:
raise e
if self._report_errors:
sentry_sdk.capture_exception(e)
sentry_sdk.flush()
Expand All @@ -82,6 +86,8 @@ def publish(self):
except KeyboardInterrupt:
return "Manual exit"
except Exception as e:
if self._raise_errors:
raise e
if self._report_errors:
sentry_sdk.capture_exception(e)
sentry_sdk.flush()
Expand All @@ -103,6 +109,8 @@ def publish(self):
except KeyboardInterrupt:
return "Manual exit"
except Exception as e:
if self._raise_errors:
raise e
error = f"An unexpected error occurred when running `{view.label}` ({error_name(e)})"
if self._report_errors:
sentry_sdk.capture_exception(e)
Expand Down

0 comments on commit 1b4be39

Please sign in to comment.