Skip to content

Commit

Permalink
change errors to severe mostly
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Dec 20, 2023
1 parent d6c1b88 commit 426b1f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sphinxcontrib/typer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def import_object(
traceback.format_exc()
)

raise self.error(err_msg)
raise self.severe(err_msg)

return obj

Expand Down Expand Up @@ -427,7 +427,7 @@ def resolve_options(
options = options(self, name, command, ctx, parent)
if isinstance(options, dict):
return options
raise self.error(
raise self.severe(
f'Invalid {parameter}, must be a dict or callable, got {type(options)}'
)

Expand Down Expand Up @@ -525,7 +525,7 @@ def get_console(stderr: bool = False) -> Console:
elif self.target == RenderTarget.TEXT:
section += nodes.literal_block('', rendered)
else:
raise self.error(f'Invalid typer render target: {self.target}')
raise self.severe(f'Invalid typer render target: {self.target}')

# recurse through subcommands if we should
if self.nested and isinstance(command, click.MultiCommand):
Expand Down Expand Up @@ -556,7 +556,7 @@ def run(self) -> t.Iterable[nodes.section]:
else re.split(r'::|[.:]', self.arguments[0])[-1]
)
except Exception as err:
raise self.error(
raise self.severe(
'Unable to determine program name, please specify using '
':prog:'
) from err
Expand Down Expand Up @@ -723,7 +723,7 @@ def typer_svg2pdf(directive: TyperDirective, svg_contents: str, pdf_path: str):

cairosvg.svg2pdf(bytestring=svg_contents, write_to=str(pdf_path))
except ImportError:
directive.error(f'cairosvg must be installed to render SVG in pdfs')
directive.severe(f'cairosvg must be installed to render SVG in pdfs')


@contextmanager
Expand All @@ -748,7 +748,7 @@ def typer_get_web_driver(directive: TyperDirective) -> t.Any:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
except ImportError:
raise directive.error(
raise directive.severe(
f'This feature requires selenium and webdriver-manager to be '
'installed.'
)
Expand Down Expand Up @@ -825,7 +825,7 @@ def edge():
yield driver
driver.quit()
else:
raise directive.error(f'Unable to initialize any webdriver.')
raise directive.severe(f'Unable to initialize any webdriver.')


def typer_convert_png(
Expand Down

0 comments on commit 426b1f5

Please sign in to comment.