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

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