-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore: update errors to be stringified when object #32663
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
base: develop
Are you sure you want to change the base?
Conversation
cypress
|
Project |
cypress
|
Branch Review |
stringify-studio-errors
|
Run status |
|
Run duration | 16m 29s |
Commit |
|
Committer | Jennifer Shehane |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
1
|
|
1
|
|
11
|
|
0
|
|
631
|
View all changes introduced in this branch ↗︎ |
UI Coverage
0%
|
|
---|---|
|
4
|
|
0
|
Accessibility
100%
|
|
---|---|
|
0 critical
0 serious
0 moderate
0 minor
|
|
0
|
Tests for review
cypress/e2e/studio/studio.cy.ts • 1 failed test • app-e2e
Test | Artifacts | |
---|---|---|
Cypress Studio > updates an existing test with assertions |
Test Replay
Screenshots
|
cypress/e2e/cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e
* Safely serializes an error object to a string, handling circular references | ||
* and other non-serializable values that would cause JSON.stringify to throw. | ||
*/ | ||
export function safeErrorSerialize (error: unknown): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just use the structured clone algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yah this is why I didn't want to get deep into this 😅
Before I looked at using https://www.npmjs.com/package/serialize-error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be addressed now
Additional details
We're getting some errors in Sentry that are reporting [object Object] and I'd like to be able to actually see the errors. Example error.
This solution isn't foolproof - it's expecting a string or object, but I just want a quick solution. I went down a rabbithole of consolidating all the error serialization one day and it was too much.
Steps to test
How has the user experience changed?
N/A
PR Tasks
cypress-documentation
?type definitions
?Note
Safely serialize non-Error exceptions using serialize-error and propagate this in Studio error handling/reporting, with new tests and dependency.
exception.safeErrorSerialize
inpackages/server/lib/cloud/exception.ts
usingserialize-error
to robustly stringify unknown errors (handles circular refs, primitives, undefined/null).Error
values toError
in:packages/server/lib/cloud/api/studio/report_studio_error.ts
packages/server/lib/cloud/studio/studio.ts
(sync and async invocations)safeErrorSerialize
inpackages/server/test/unit/cloud/exceptions_spec.js
.Error
handling in both sync/async paths and API reporting.serialize-error
topackages/server/package.json
.Written by Cursor Bugbot for commit 0be6bef. This will update automatically on new commits. Configure here.