MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / handle_error

Function handle_error

codewiki/cli/utils/errors.py:64–83  ·  view source on GitHub ↗

Handle errors and return appropriate exit code. Args: error: The exception to handle verbose: Whether to show detailed error information Returns: Exit code for the error

(error: Exception, verbose: bool = False)

Source from the content-addressed store, hash-verified

62
63
64class IncompleteGenerationError(CodeWikiError):
65 """Generation finished but some module docs are missing on disk."""
66
67 def __init__(self, message: str, missing_modules: list = None):
68 self.missing_modules = missing_modules or []
69 super().__init__(message, EXIT_GENERAL_ERROR)
70
71
72def handle_error(error: Exception, verbose: bool = False) -> int:
73 """
74 Handle errors and return appropriate exit code.
75
76 Args:
77 error: The exception to handle
78 verbose: Whether to show detailed error information
79
80 Returns:
81 Exit code for the error
82 """
83 if isinstance(error, CodeWikiError):
84 click.secho(f"\n✗ Error: {error.message}", fg="red", err=True)
85 return error.exit_code
86 else:

Callers 5

config_setFunction · 0.90
config_showFunction · 0.90
config_validateFunction · 0.90
config_agentFunction · 0.90
generate_commandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected