Skip to content

Commit

Permalink
Added a new raw error mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroBone committed Jan 21, 2024
1 parent 8b0e60e commit 77a38bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/dev/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* Fixed multiple bugs, including one critical bug.
* Added a possibility of using external errors as causes of OfficialEye errors.
* Added support for non-shape-preserving mutators.
* Added a new `-re` flag allowing one to disable built-in error handling.
* Slightly changed logging style.
* Refactor.

[View on GitHub](https://github.com/ZeroBone/OfficialEye/releases/tag/1.1.4){ .md-button }
Expand Down
13 changes: 7 additions & 6 deletions src/officialeye/_internal/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@click.option("-q", "--quiet", is_flag=True, show_default=True, default=False, help="Disable standard output messages.")
@click.option("-v", "--verbose", is_flag=True, show_default=True, default=False, help="Enable verbose logging.")
@click.option("-dl", "--disable-logo", is_flag=True, show_default=True, default=False, help="Disable the officialeye logo.")
def cli(debug: bool, edir: str, quiet: bool, verbose: bool, disable_logo: bool):
@click.option("-re", "--raw-errors", is_flag=True, show_default=False, default=False, help="Do not handle errors.")
def cli(debug: bool, edir: str, quiet: bool, verbose: bool, disable_logo: bool, raw_errors: bool):
global _context_manager

# configure logger
Expand All @@ -34,17 +35,17 @@ def cli(debug: bool, edir: str, quiet: bool, verbose: bool, disable_logo: bool):
get_logger().verbose_mode = verbose
get_logger().disable_logo = disable_logo

# print OfficialEye logo if necessary
get_logger().logo()

# configure context manager
if edir is not None:
_context_manager.export_directory = edir

if get_logger().debug_mode:
# enable raw tracebacks if debugging
if raw_errors:
get_logger().warn("Raw error mode enabled. Use this mode only if you know precisely what you are doing!")
_context_manager.handle_exceptions = False

# print OfficialEye logo if necessary
get_logger().logo()

# print preliminary warning if necessary
if get_logger().debug_mode:
get_logger().warn("Debug mode enabled. Disable for production use to improve performance.")
Expand Down

0 comments on commit 77a38bd

Please sign in to comment.