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

Revamp error handling and improve Sentry integration #218

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

Conversation

tx-nikola
Copy link

@tx-nikola tx-nikola commented Feb 11, 2025

Set up Sentry in order to log messages

Setup the Sentry organization and project

  • For the project environment, choose “Vue

  • Find and copy the Sentry DSN url in this format: “https://<first_number>@<second_number>.ingest.de.sentry.io/<id>” - just a whole DSN url

  • Set up the env variables:

    • SENTRY_DSN # The DSN url mentioned above
    • SENTRY_ENV # The environment so we can filter the issues easily -> “localhost” | “production” | “development”
  • Then we can get the logged issues from the app

  • We choose the issue in the “Issues” tab

    • Here we have the information that Sentry picks up
      • For making it easier to resolve issues, for custom handled errors, we also log some of the data related to the errors, such as: error, parentFunctionName, parentFunctionParams, accountAddress, filePath - in order to find and understand the issue easily (eg. if the params were wrong, which function threw the error, etc.)
    • This information can be found in the ReferenceError section of the Issue on the sentry platform
  • If we deem some errors not important, and want to limit the number of raised issues (pricing, clutter, etc.) we can additionally ignore them in the config like this:

ignoreErrors: [
  "Network error. Check your internet connection and try again.",
  "Network Error",
  "Invalid network",
  "Incorrect wallet network selected",
  "transfer amount exceeds allowance",
],

and those errors wouldn’t be logged on the platform.

This PR fixes #217

@tx-nikola tx-nikola added the enhancement New feature or request label Feb 11, 2025
@tx-nikola tx-nikola self-assigned this Feb 11, 2025
Copy link

github-actions bot commented Feb 11, 2025

Visit the preview URL for this PR (updated for commit d0877d9):

https://staging-zksync-dapp-wallet-v2--pr218-tx-nikola-txfusio-edrwbhwy.web.app

(expires Tue, 18 Feb 2025 13:14:22 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a25831e6058958ccabf0f806505b5b8e7241b178

@tx-nikola tx-nikola changed the title Revamp error handling and improve Sentry integration [DON'T MERGE] Revamp error handling and improve Sentry integration Feb 11, 2025
@popzxc
Copy link
Member

popzxc commented Feb 11, 2025

Set up before merging

Can't we implement it in an additive form, e.g. sentry is only initialized if corresponding env variables are set?
I'm not sure if every project that uses the portal will set up Sentry (at least, right away).

@tx-nikola tx-nikola changed the title [DON'T MERGE] Revamp error handling and improve Sentry integration Revamp error handling and improve Sentry integration Feb 11, 2025
@tx-nikola tx-nikola requested a review from popzxc February 11, 2025 13:12
@tx-nikola
Copy link
Author

@popzxc
Added the changes to omit initializing Sentry SDK if the DSN is not defined in the .env variables.
Also added a small section in the README.md for Sentry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revamp error handling and improve Sentry integration
2 participants