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 |
|---|---|---|
| .. | ||
| limiter | Loading commit data... | |
| api_type.go | Loading commit data... | |
| constants.go | Loading commit data... | |
| crypto.go | Loading commit data... | |
| custom-event.go | Loading commit data... | |
| database.go | Loading commit data... | |
| email-outlook-auth.go | Loading commit data... | |
| email.go | Loading commit data... | |
| embed-file-system.go | Loading commit data... | |
| endpoint_type.go | Loading commit data... | |
| env.go | Loading commit data... | |
| gin.go | Loading commit data... | |
| go-channel.go | Loading commit data... | |
| gopool.go | Loading commit data... | |
| http.go | Loading commit data... | |
| init.go | Loading commit data... | |
| json.go | Loading commit data... | |
| logger.go | Loading commit data... | |
| model.go | Loading commit data... | |
| page_info.go | Loading commit data... | |
| pprof.go | Loading commit data... | |
| rate-limit.go | Loading commit data... | |
| redis.go | Loading commit data... | |
| str.go | Loading commit data... | |
| topup-ratio.go | Loading commit data... | |
| utils.go | Loading commit data... | |
| validate.go | Loading commit data... | |
| verification.go | Loading commit data... |