Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text to autopygen exceptions #1444

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading