-
Notifications
You must be signed in to change notification settings - Fork 173
feat(csharp/src/Drivers): Format thrift error #3019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…s with HTTP status codes
CurtHagenlocher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've left a few nitpicking comments and a question.
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading; | ||
| using System.Text.RegularExpressions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: sort
| internal static string FormatTransportExceptionMessage(Exception exception) | ||
| { | ||
| var customMsg = ""; | ||
| // Use ContainsException to robustly find TTransportException or HttpRequestException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't line up well with what the code is doing.
| } | ||
| } | ||
| } | ||
| return $"{customMsg}{Environment.NewLine}{exception.Message}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newline here is being added even when customMsg is empty. Does that produce the desired experience?
Improve Transport Exception Error Messages in C# Apache Driver
This PR enhances the error handling for Thrift transport exceptions in the C# Apache driver by adding a new method
FormatTransportExceptionMessagethat extracts HTTP status codes from exception messages and provides more user-friendly error messages for common HTTP errors (401, 403, 404).Proposed changes
FormatTransportExceptionMessagemethod to extract and format HTTP status codes from Thrift transport exceptionsFormatExceptionMessagemethod to use the new formatting functionHow is this tested