Skip to content

Commit e342bdb

Browse files
therealjohnjongio
andauthored
Update cli/azd/extensions/azure.ai.agents/internal/cmd/session.go
Co-authored-by: Jon Gallant <2163001+jongio@users.noreply.github.com>
1 parent d4057b6 commit e342bdb

File tree

1 file changed

+17
-5
lines changed
  • cli/azd/extensions/azure.ai.agents/internal/cmd

1 file changed

+17
-5
lines changed

cli/azd/extensions/azure.ai.agents/internal/cmd/session.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,23 @@ The isolation key is derived from the Entra token by default.`,
418418
flags.isolationKey,
419419
DefaultVNextAgentAPIVersion,
420420
)
421-
if err != nil {
422-
return exterrors.ServiceFromAzure(
423-
err, exterrors.OpDeleteSession,
424-
)
425-
}
421+
if err != nil {
422+
if respErr, ok := errors.AsType[*azcore.ResponseError](err); ok &&
423+
respErr.StatusCode == http.StatusNotFound {
424+
return exterrors.Validation(
425+
exterrors.CodeSessionNotFound,
426+
fmt.Sprintf(
427+
"session %q not found or has already been deleted",
428+
sessionID,
429+
),
430+
"use 'azd ai agent sessions list' to see "+
431+
"available sessions",
432+
)
433+
}
434+
return exterrors.ServiceFromAzure(
435+
err, exterrors.OpDeleteSession,
436+
)
437+
}
426438

427439
fmt.Printf(
428440
"Session %q deleted from agent %q.\n",

0 commit comments

Comments
 (0)