mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-14 00:54:56 -05:00
refactor(server): standardize tool error handling and status code mapping (#2402)
- Detect errors and return error codes accordingly in the tool call handler functions. - Replace the old `util.ErrUnauthorized` with the new Toolbox error type.
This commit is contained in:
@@ -169,11 +169,10 @@ func TestCloneInstanceToolEndpoints(t *testing.T) {
|
||||
want: `{"name":"op2","status":"PENDING"}`,
|
||||
},
|
||||
{
|
||||
name: "missing destination instance name",
|
||||
toolName: "clone-instance",
|
||||
body: `{"project": "p1", "sourceInstanceName": "source-instance"}`,
|
||||
expectError: true,
|
||||
errorStatus: http.StatusBadRequest,
|
||||
name: "missing destination instance name",
|
||||
toolName: "clone-instance",
|
||||
body: `{"project": "p1", "sourceInstanceName": "source-instance"}`,
|
||||
want: `{"error":"parameter \"destinationInstanceName\" is required"}`,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user