Skip to content

Commit 70777b9

Browse files
committed
fix lint
1 parent d8c9028 commit 70777b9

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

internal/server/api.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,11 @@ func toolInvokeHandler(s *Server, w http.ResponseWriter, r *http.Request) {
233233

234234
params, err := parameters.ParseParams(tool.GetParameters(), data, claimsFromAuth)
235235
if err != nil {
236-
// If auth error, return 401
237-
errMsg := fmt.Sprintf("error parsing authenticated parameters from ID token: %w", err)
236+
// If auth error, return 401 or 403
238237
var clientServerErr *util.ClientServerError
239-
if errors.As(err, &clientServerErr) && clientServerErr.Code == http.StatusUnauthorized {
240-
s.logger.DebugContext(ctx, errMsg)
241-
_ = render.Render(w, r, newErrResponse(err, http.StatusUnauthorized))
238+
if errors.As(err, &clientServerErr) && (clientServerErr.Code == http.StatusUnauthorized || clientServerErr.Code == http.StatusForbidden) {
239+
s.logger.DebugContext(ctx, fmt.Sprintf("error parsing authenticated parameters from ID token: %s", err))
240+
_ = render.Render(w, r, newErrResponse(err, clientServerErr.Code))
242241
return
243242
}
244243
err = fmt.Errorf("provided parameters were invalid: %w", err)

internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para
247247
for retries < maxRetries {
248248
select {
249249
case <-ctx.Done():
250-
return nil, util.NewAgentError("timed out waiting for operation %s", ctx.Err())
250+
return nil, util.NewAgentError("timed out waiting for operation", ctx.Err())
251251
default:
252252
}
253253

internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string,
131131

132132
func (t Tool) GetParameters() parameters.Parameters {
133133
return t.Parameters
134-
}
134+
}

internal/tools/dgraph/dgraph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string,
131131

132132
func (t Tool) GetParameters() parameters.Parameters {
133133
return t.Parameters
134-
}
134+
}

0 commit comments

Comments
 (0)