Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Oct 16, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 16, 2025 19:16
@github-actions
Copy link

github-actions bot commented Oct 16, 2025

Copyright Validation Results
Total: 2 | Passed: 2 | Failed: 0 | Skipped: 0 | at: 2025-10-16 20:14:58 UTC | commit: 73a3598

✅ Valid Files

  • lib/responder.js
  • test-basic/validateDoc-test.js

✅ All files have valid copyright headers!

Copy link

Copilot AI left a 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
Comment on lines 1043 to 1044
// Enhance error message with response body details for better debugging
clientError.message = clientError.message + ' - Server response: ' + bodyMsg;
Copy link

Copilot AI Oct 16, 2025

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.

Suggested change
// 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);

Copilot uses AI. Check for mistakes.
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;
Copy link

Copilot AI Oct 16, 2025

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}``

Suggested change
clientError.message = clientError.message + ' - Server response: ' + bodyMsg;
clientError.message = `${clientError.message} - Server response: ${bodyMsg}`;

Copilot uses AI. Check for mistakes.
anu3990
anu3990 previously approved these changes Oct 16, 2025
Fixed test that was do an equals comparison on the error message, and it no longer times out now.
@rjrudin rjrudin force-pushed the feature/24763-add-error branch from 3db7c5f to 73a3598 Compare October 16, 2025 20:14
@rjrudin rjrudin merged commit 95d1807 into develop Oct 16, 2025
2 checks passed
@rjrudin rjrudin deleted the feature/24763-add-error branch October 16, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants