mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-05-02 03:00:36 -04:00
add compile time check
This commit is contained in:
@@ -35,6 +35,8 @@ type AgentError struct {
|
||||
Cause error
|
||||
}
|
||||
|
||||
var _ ToolboxError = &AgentError{}
|
||||
|
||||
func (e *AgentError) Error() string { return e.Msg }
|
||||
|
||||
func (e *AgentError) Category() ErrorCategory { return CategoryAgent }
|
||||
@@ -45,6 +47,8 @@ func NewAgentError(msg string, cause error) *AgentError {
|
||||
return &AgentError{Msg: msg, Cause: cause}
|
||||
}
|
||||
|
||||
var _ ToolboxError = &AgentError{}
|
||||
|
||||
// ClientServerError returns 4XX/5XX error code
|
||||
type ClientServerError struct {
|
||||
Msg string
|
||||
@@ -52,6 +56,8 @@ type ClientServerError struct {
|
||||
Cause error
|
||||
}
|
||||
|
||||
var _ ToolboxError = &ClientServerError{}
|
||||
|
||||
func (e *ClientServerError) Error() string { return fmt.Sprintf("%s: %v", e.Msg, e.Cause) }
|
||||
|
||||
func (e *ClientServerError) Category() ErrorCategory { return CategoryServer }
|
||||
|
||||
Reference in New Issue
Block a user