This commit refactors the application's error handling mechanism by introducing a new standardized error type, `types.NewAPIError`. It also renames common JSON utility functions for better clarity. Previously, internal error handling was tightly coupled to the `dto.OpenAIError` format. This change decouples the internal logic from the external API representation. Key changes: - A new `types.NewAPIError` struct is introduced to serve as a canonical internal representation for all API errors. - All relay adapters (OpenAI, Claude, Gemini, etc.) are updated to return `*types.NewAPIError`. - Controllers now convert the internal `NewAPIError` to the client-facing `OpenAIError` format at the API boundary, ensuring backward compatibility. - Channel auto-disable/enable logic is updated to use the new standardized error type. - JSON utility functions are renamed to align with Go's standard library conventions (e.g., `UnmarshalJson` -> `Unmarshal`, `EncodeJson` -> `Marshal`).
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| audio.go | Loading commit data... | |
| cf_worker.go | Loading commit data... | |
| channel.go | Loading commit data... | |
| convert.go | Loading commit data... | |
| epay.go | Loading commit data... | |
| error.go | Loading commit data... | |
| file_decoder.go | Loading commit data... | |
| http_client.go | Loading commit data... | |
| image.go | Loading commit data... | |
| log_info_generate.go | Loading commit data... | |
| midjourney.go | Loading commit data... | |
| notify-limit.go | Loading commit data... | |
| quota.go | Loading commit data... | |
| sensitive.go | Loading commit data... | |
| str.go | Loading commit data... | |
| task.go | Loading commit data... | |
| token_counter.go | Loading commit data... | |
| usage_helpr.go | Loading commit data... | |
| user_notify.go | Loading commit data... | |
| webhook.go | Loading commit data... |