hide errors if user is just getting help or version info

This commit is contained in:
Nick Sweeting 2024-10-08 19:20:03 -07:00
parent 9f274cf9f4
commit 7c34f2bc90
No known key found for this signature in database
2 changed files with 15 additions and 11 deletions

View file

@ -595,16 +595,20 @@ def setup_django(out_dir: Path | None=None, check_db=False, config: benedict=CON
django.setup()
except Exception as e:
bump_startup_progress_bar(advance=1000)
STDERR.print()
STDERR.print(Panel(
f'\n[red]{e.__class__.__name__}[/red]: [yellow]{e}[/yellow]\nPlease check your config and [blue]DATA_DIR[/blue] permissions.\n',
title='\n\n[red][X] Error while trying to load database![/red]',
subtitle='[grey53]NO WRITES CAN BE PERFORMED[/grey53]',
expand=False,
style='bold red',
))
STDERR.print()
STDERR.print_exception(show_locals=False)
subcommand = sys.argv[1] if len(sys.argv) > 1 else 'unknown'
if subcommand not in ('help', 'version', '--help', '--version'):
# show error message to user only if they're not running a meta command / just trying to get help
STDERR.print()
STDERR.print(Panel(
f'\n[red]{e.__class__.__name__}[/red]: [yellow]{e}[/yellow]\nPlease check your config and [blue]DATA_DIR[/blue] permissions.\n',
title='\n\n[red][X] Error while trying to load database![/red]',
subtitle='[grey53]NO WRITES CAN BE PERFORMED[/grey53]',
expand=False,
style='bold red',
))
STDERR.print()
STDERR.print_exception(show_locals=False)
return
bump_startup_progress_bar()

View file

@ -1,6 +1,6 @@
[project]
name = "archivebox"
version = "0.8.5rc19"
version = "0.8.5rc20"
requires-python = ">=3.10"
description = "Self-hosted internet archiving solution."
authors = [{name = "Nick Sweeting", email = "pyproject.toml@archivebox.io"}]