Skip to content

Add support for Error.prototype.cause#296

Merged
Skn0tt merged 5 commits intoflightcontrolhq:mainfrom
shortercode:Issue-294
Sep 29, 2025
Merged

Add support for Error.prototype.cause#296
Skn0tt merged 5 commits intoflightcontrolhq:mainfrom
shortercode:Issue-294

Conversation

@shortercode
Copy link
Contributor

Relates to #294

Modifies the isDeep call to match Error objects, so that causes are correctly serialised.
Adds the cause field to serialised Error format and the deserialiser.

Copy link
Collaborator

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks good generally, but please add some tests to convince me this works as intended.

@shortercode
Copy link
Contributor Author

Thanks for the PR! Looks good generally, but please add some tests to convince me this works as intended.

Apologies @Skn0tt been rather side tracked on other work. Is the test I've added sufficient or would you like a more comprehensive set?

For context we use electron-trpc and frequently pass Result style objects back to our renderer thread. This change will allow us to preserve our error causes which hold a lot more useful information than the stack.

@matthew-magical
Copy link

@shortercode Thanks for making this PR as I'm encountering the same limitation.
@Skn0tt not sure if you saw the question above?

Copy link
Collaborator

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@Skn0tt Skn0tt merged commit bc7a825 into flightcontrolhq:main Sep 29, 2025
@shortercode shortercode deleted the Issue-294 branch September 29, 2025 14:56
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.

3 participants

Comments