mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-04 20:25:05 -05:00
add error formatting
This commit is contained in:
@@ -44,7 +44,12 @@ type AgentError struct {
|
||||
|
||||
var _ ToolboxError = &AgentError{}
|
||||
|
||||
func (e *AgentError) Error() string { return e.Msg }
|
||||
func (e *AgentError) Error() string {
|
||||
if e.Cause != nil {
|
||||
return fmt.Sprintf("%s: %v", e.Msg, e.Cause)
|
||||
}
|
||||
return e.Msg
|
||||
}
|
||||
|
||||
func (e *AgentError) Category() ErrorCategory { return CategoryAgent }
|
||||
|
||||
@@ -63,7 +68,12 @@ type ClientServerError struct {
|
||||
|
||||
var _ ToolboxError = &ClientServerError{}
|
||||
|
||||
func (e *ClientServerError) Error() string { return fmt.Sprintf("%s: %v", e.Msg, e.Cause) }
|
||||
func (e *ClientServerError) Error() string {
|
||||
if e.Cause != nil {
|
||||
return fmt.Sprintf("%s: %v", e.Msg, e.Cause)
|
||||
}
|
||||
return e.Msg
|
||||
}
|
||||
|
||||
func (e *ClientServerError) Category() ErrorCategory { return CategoryServer }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user