sindresorhus / electron-better-ipc

Simplified IPC communication for Electron apps
MIT License
715 stars 60 forks source link

Errors passed as empty objects #7

Closed lselden closed 5 years ago

lselden commented 5 years ago

Issuehunt badges

In answerRenderer and answerMain errors get passed directly to electron ipc, which serializes Errors as plain objects (https://github.com/electron/electron/issues/7956)

I made a patch that uses your serialize-errors library, but didn't create a pull request because I'm not sure my changes to the test fixtures are up to snuff.

patch: https://github.com/lselden/electron-better-ipc/commit/1f3d72ec5eb1e68d47fbc2454a663391d509fcce


IssueHunt Summary #### [jackple jackple](https://issuehunt.io/u/jackple) has been rewarded. ### Backers (Total: $90.00) - [issuehunt issuehunt](https://issuehunt.io/u/issuehunt) ($90.00) ### Submitted pull Requests - [#22 error transmit](https://issuehunt.io/r/sindresorhus/electron-better-ipc/pull/22) --- ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/sindresorhus/electron-better-ipc/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds. --- IssueHunt has been backed by the following sponsors. [Become a sponsor](https://issuehunt.io/membership/members)
oeddyo commented 5 years ago

Also found this problem. This is due to ipcRenderer will serialize the paramter passed in. And error object can't be serialized properly.

https://electronjs.org/docs/api/ipc-renderer

@sindresorhus is it possible we can merge this please?

sindresorhus commented 5 years ago

You also need to deserialize the serialized error back to an proper error type. Should be done by adding a .deserialize() method to https://github.com/sindresorhus/serialize-error and then use that here. Then do a PR.

IssueHuntBot commented 5 years ago

@issuehunt has funded $50.00 to this issue.


lselden commented 5 years ago

I'm not actively working on a project that would use this, but may get to it in the future...if anyone else wants to take it on they're 100% welcome to do so.

IssueHuntBot commented 5 years ago

@issuehunt has funded $40.00 to this issue.


jackple commented 5 years ago

I have used #22 in my project, please check it.

issuehunt-oss[bot] commented 5 years ago

@sindresorhus has rewarded $81.00 to @jackple. See it on IssueHunt