Skip to content

Commit

Permalink
Merge pull request #1444 from bernt-matthias/autopygen-exception-text
Browse files Browse the repository at this point in the history
Add text to autopygen exceptions
  • Loading branch information
mvdbeek authored May 7, 2024
2 parents 15e3494 + 0ba4651 commit 8a1ad34
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def visit_ImportFrom(self, node: ast.ImportFrom) -> Any:

def report_findings(self) -> Tuple[List[ast.AST], Optional[str], Optional[str], Set[str]]:
if self.argparse_module_alias is None and self.argument_parser_alias is None:
raise ArgParseImportNotFound()
raise ArgParseImportNotFound("No argparse import found")

return (self.actions, self.argparse_module_alias, self.argument_parser_alias, self.known_names)

Expand Down Expand Up @@ -165,7 +165,7 @@ def _replace_parser(self, node: ast.Assign, imported_using_from: bool):

def report_findings(self) -> Tuple:
if self.main_parser_name is None:
raise ArgParserNotUsed
raise ArgParserNotUsed("Argument parser not used")

return self.actions, self.main_parser_name

Expand Down Expand Up @@ -243,7 +243,7 @@ def get_parser_init_and_actions(source: ast.Module) -> Tuple[List[ast.AST], str,
custom_parser_class_def = obtain_class_def()

if custom_parser_class_def is None:
raise CustomParserUnavailableException()
raise CustomParserUnavailableException("Custom parser unavailable")

import_discovery = ImportDiscovery(actions)
actions, argparse_module_alias, argparse_class_alias, known_names = import_discovery.visit_and_report(source)
Expand Down

0 comments on commit 8a1ad34

Please sign in to comment.