Display API error with formatting. Args: error: The API error module_name: Optional module name for context
(error: APIError, module_name: Optional[str] = None)
| 87 | def display_api_error(error: APIError, module_name: Optional[str] = None): |
| 88 | """ |
| 89 | Display API error with formatting. |
| 90 | |
| 91 | Args: |
| 92 | error: The API error |
| 93 | module_name: Optional module name for context |
| 94 | """ |
| 95 | click.echo() |
| 96 | click.secho("✗ LLM API Error", fg="red", bold=True) |
| 97 | click.echo() |
| 98 | |
| 99 | if module_name: |
| 100 | click.echo(f"Module: {module_name}") |
| 101 | click.echo() |
| 102 | |
| 103 | click.echo(error.message) |
| 104 | click.echo() |
| 105 | click.secho("Documentation generation stopped. No partial results saved.", fg="yellow") |
| 106 | click.echo() |
| 107 | |
| 108 | |
| 109 | def wrap_api_call(func, *args, fail_fast: bool = True, context: Optional[str] = None, **kwargs): |
| 110 | """ |
| 111 | Wrap an API call with error handling. |
| 112 | |
| 113 | Args: |
| 114 | func: Function to call |