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

fix: kickOut takes a reason error rather than a message string #1567

Merged
merged 6 commits into from
Aug 20, 2020

Conversation

erights
Copy link
Member

@erights erights commented Aug 20, 2020

Prior to this PR we have the following line of code:

throw zcfSeat.kickOut(err.message);

The problem with this pattern of code is that err had an associated stack trace, whereas err.message is just a string. Currently we're not doing anything to correlate stack traces of sent errors with received errors, but I'm hoping to change that. This PR is in anticipation of that change.

I adopt the naming convention associated with a promise's rejection reason, which is normally an error object, of calling it a reason. I change kickOut to accept such a reason error rather than a message string. I fix the types, including noticing and fixing a bug in the notifier's type of updater.fail. This was declared with the same T template variable as for the values being reported, which was always wrong. It is now specifically a reason: Error.

Where the zcfSeat does an eventual send of kickOut to the zoeSeat, it also hardens the reason. The marshal layer transmits simple hardened errors. The marshal layer currently does not to enable recovery of the stack, but that's where I'm going.

This came up when @michaelfig and I were working on upgrading pegasus to the new Zoe.

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

I think reason should be typed as any, just as Promise.reject.

@erights erights merged commit c3cd536 into master Aug 20, 2020
@erights erights deleted the reason-not-message branch August 20, 2020 02:21
@katelynsills
Copy link
Contributor

looks good!

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