Skip to content

Make sure error message is explicitly shown for 500 errors#12845

Merged
kmcgrady merged 2 commits intodevelopfrom
fix/connection-error-message
Oct 22, 2025
Merged

Make sure error message is explicitly shown for 500 errors#12845
kmcgrady merged 2 commits intodevelopfrom
fix/connection-error-message

Conversation

@kmcgrady
Copy link
Copy Markdown
Collaborator

Describe your changes

In the event of an 500 error on connection and the response is an object, we get the [Object object] error in the message. This change will JSON stringify it in the event we detect it's an object.

Testing Plan

  • Added unit tests for JS

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@kmcgrady kmcgrady added security-assessment-completed change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Oct 22, 2025
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Oct 22, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Licenses 0 0 0 0 0 issues
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 22, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12845/streamlit-1.50.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12845.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot October 22, 2025 15:45
Copy link
Copy Markdown
Contributor

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 fixes the display of error messages when a 500 error occurs with an object response. Previously, object responses would be displayed as "[Object object]" in the error message. The fix stringifies object responses to show meaningful error information.

Key Changes:

  • Modified error message formatting to wrap responses in markdown code blocks
  • Added JSON stringification for object-type responses with pretty printing
  • Added unit test coverage for the new object response handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/connection/src/DoInitPings.tsx Updated error message formatting to stringify object responses and wrap all responses in markdown code blocks
frontend/connection/src/WebsocketConnection.test.tsx Updated existing test assertion and added new test case for object response handling

Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to the copilot suggestion, but LGTM overall

@kmcgrady kmcgrady merged commit fe9b8f4 into develop Oct 22, 2025
37 checks passed
@kmcgrady kmcgrady deleted the fix/connection-error-message branch October 22, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants