Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/Microsoft.Mcp.Core/src/Commands/BaseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected virtual void HandleException(CommandContext context, Exception ex)
{
ArgumentException => HttpStatusCode.BadRequest, // Bad Request for invalid arguments
InvalidOperationException => HttpStatusCode.UnprocessableEntity, // Unprocessable Entity for configuration errors
HttpRequestException httpEx => httpEx.StatusCode ?? HttpStatusCode.ServiceUnavailable,
_ => HttpStatusCode.InternalServerError // Internal Server Error for unexpected errors
};

Expand Down
2 changes: 1 addition & 1 deletion core/Microsoft.Mcp.Core/src/Commands/GlobalCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected override TOptions BindOptions(ParseResult parseResult)
KeyNotFoundException => HttpStatusCode.NotFound,
AuthenticationFailedException => HttpStatusCode.Unauthorized,
RequestFailedException rfEx => (HttpStatusCode)rfEx.Status,
HttpRequestException => HttpStatusCode.ServiceUnavailable,
HttpRequestException httpEx => httpEx.StatusCode ?? HttpStatusCode.ServiceUnavailable,
_ => HttpStatusCode.InternalServerError
Comment thread
alzimmermsft marked this conversation as resolved.
Comment thread
alzimmermsft marked this conversation as resolved.
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Other Changes"
description: "Update HttpRequestException to attempt to return a more specific status code for better troubleshooting"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Other Changes"
description: "Update HttpRequestException to attempt to return a more specific status code for better troubleshooting"
Loading