Skip to content
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

feat: error handling for HttpErrorResponse #2324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

dianasavvatina
Copy link
Contributor

@dianasavvatina dianasavvatina commented Jan 14, 2025

Proposed changes

Added handling for HttpErrorResponse:

  • clear error text
  • passing clear response to the dApp
  • clear info about which url caused the error

DApp gets this error if used with WalletConnect

{
  "code": 503,
  "message": "HTTP request failed for https://rpc.ghostnet.teztnets.com/chains/main/blocks/head/context/constants (503) Service Unavailable - The server is temporarily unable to handle the request. Please try again later or contact support.",
  "data": [
    503,
    "Service Unavailable - The server is temporarily unable to handle the request. Please try again later or contact support.",
    "",
    "https://rpc.ghostnet.teztnets.com/chains/main/blocks/head/context/constants"
  ]
}

Types of changes

  • Bugfix
  • New feature
  • Refactor
  • Breaking change
  • UI fix

Steps to reproduce

Screenshots

Add the screenshots of how the app used to look like and how it looks now

Before:
image

The only useful message comes for error 500. So we need to strip it from tags and keep for the user:
image

Data-polling:

image

Now:
image

image image

Data polling:

image

Checklist

  • Tests that prove my fix is effective or that my feature works have been added
  • Documentation has been added (if appropriate)
  • Screenshots are added (if any UI changes have been made)
  • All TODOs have a corresponding task created (and the link is attached to it)

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umami-embed-iframe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 4:51pm
umami-embed-iframe-ghostnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 4:51pm
umami-v2-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 4:51pm
umami-v2-web-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 4:51pm

Comment on lines +110 to +111
return html
.replace(/<[^>]*>/g, "") // remove tags

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '<' and with many repetitions of '<'.
This
regular expression
that depends on
library input
may run slow on strings starting with '<' and with many repetitions of '<'.
Comment on lines +110 to +111
return html
.replace(/<[^>]*>/g, "") // remove tags

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High

This string may still contain
<script
, which may cause an HTML element injection vulnerability.

Copilot Autofix AI 8 minutes ago

Generating an autofix suggestion, this might take a while…

 
 
 
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.

1 participant