-
Notifications
You must be signed in to change notification settings - Fork 53
MLE-24763 Including server response body in error message #994
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
Conversation
|
Copyright Validation Results ✅ Valid Files
✅ All files have valid copyright headers! |
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.
Pull Request Overview
This PR enhances error messages by including the server response body for better debugging capabilities when API requests fail.
- Adds server response body content to client error messages
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
lib/responder.js
Outdated
| // Enhance error message with response body details for better debugging | ||
| clientError.message = clientError.message + ' - Server response: ' + bodyMsg; |
Copilot
AI
Oct 16, 2025
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.
Directly concatenating server response body to error messages could expose sensitive information like API keys, tokens, or internal system details in logs. Consider sanitizing the response body or limiting the amount of data included to prevent information disclosure.
| // Enhance error message with response body details for better debugging | |
| clientError.message = clientError.message + ' - Server response: ' + bodyMsg; | |
| // Enhance error message with a sanitized/truncated response body for better debugging | |
| clientError.message = clientError.message + ' - Server response (truncated): ' + getSafeErrorBodySnippet(bodyMsg, contentType); |
lib/responder.js
Outdated
| mlutil.parseJSON(bodyMsg) : bodyMsg; | ||
|
|
||
| // Enhance error message with response body details for better debugging | ||
| clientError.message = clientError.message + ' - Server response: ' + bodyMsg; |
Copilot
AI
Oct 16, 2025
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.
[nitpick] The error message formatting could be improved by using template literals for better readability: clientError.message = ${clientError.message} - Server response: ${bodyMsg}``
| clientError.message = clientError.message + ' - Server response: ' + bodyMsg; | |
| clientError.message = `${clientError.message} - Server response: ${bodyMsg}`; |
3d410dc to
3db7c5f
Compare
Fixed test that was do an equals comparison on the error message, and it no longer times out now.
3db7c5f to
73a3598
Compare
No description provided.