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

Catch application runtime bugs in an error boundary and record stacktraces in telemetry #3387

Closed
ericpgreen2 opened this issue Nov 5, 2023 · 4 comments · Fixed by #4307
Closed
Assignees

Comments

@ericpgreen2
Copy link
Contributor

ericpgreen2 commented Nov 5, 2023

For capturing runtime errors:

  • Svelte does not have a native error boundary. See: Error Boundary RFC sveltejs/rfcs#46.
  • The oft-cited third-party Svelte library is the Crown Framework, but it is unmaintained.
  • Hooking into window.onerror and window.onunhandledrejection seems like one valid option.
window.onerror = (msg, url, line, col, error) => {
    // capture error & emit telemetry
    // show a full error page
};
window.onunhandledrejection = (event) => {
    // capture error & emit telemetry
    // show a full error page
};
  • Sentry implies their Svelte SDK captures runtime errors

For recording stacktraces in telemetry:

  • Let's use Sentry
  • Ideally we proxy the requests through our backend
@AdityaHegde
Copy link
Collaborator

AdityaHegde commented Dec 5, 2023

Done as part of #3516

@ericpgreen2
Copy link
Contributor Author

Re-opening because we still need to do this for Rill Developer.

@ericpgreen2 ericpgreen2 reopened this Dec 5, 2023
@ericpgreen2
Copy link
Contributor Author

ericpgreen2 commented Jan 17, 2024

Notes for the second pass:

  • Telemetry for Rill Developer (as mentioned above)
  • Capture more information for the "unknown error" case. It's happening frequently. Here's some code from ChatGPT that might be helpful:
    if (!error.response) {
      if (error.code === 'ECONNABORTED') {
        console.log('Request timed out');
      } else if (error.message.includes('Network Error')) {
        console.log('Network error - the request was made but no response was received');
      } else if (error.message === 'Request aborted') {
        console.log('Request was aborted');
      } else {
        console.log('Unknown error occurred');
      }
    }
  • Capture the full page route. This will inform us of the environment dev/test/stage/prod, the specific dashboard, and any query parameters.
  • Capture the Rill application version

@AdityaHegde
Copy link
Collaborator

There were some challenges to get this working locally and not have a lot of spam. Especially when actively modelling there are a lot of errors for the resource API when the model is not valid.

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 a pull request may close this issue.

3 participants