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(casting): dont crash on bad capdata #8562

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented Nov 23, 2023

refs Agoric/ui-kit#57
refs #8579

Explanation in the comment thread of the issue. TL;DR - The follower was crashing silently after hitting bad capdata. This change makes it so that instead it surfaces an error instead of a value in that case, and keeps yielding more values.

Added a unit test to ensure that it properly surfaces the error and can keep yielding more values afterwards.

@samsiegart samsiegart force-pushed the sam/casting-capdata-errors branch 2 times, most recently from 87aa97a to eca302f Compare November 23, 2023 22:27
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 like how self-contained it is. LGTM!

Please consider un-templatizing the ValueFollowerBase, but whether you choose to is not a blocker.

@@ -40,14 +40,18 @@ export {};
*/

/**
* @see {ChangeFollower}
* @template T
Copy link
Member

Choose a reason for hiding this comment

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

The base no longer needs to be a template.

Suggested change
* @template T

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch, removed

/**
* @see {ChangeFollower}
* @template T
* @typedef {ValueFollowerBase<T> & ({ value: T } | { value: undefined, error: any })} ValueFollowerElement
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @typedef {ValueFollowerBase<T> & ({ value: T } | { value: undefined, error: any })} ValueFollowerElement
* @typedef {ValueFollowerBase & ({ value: T } | { value: undefined, error: any })} ValueFollowerElement

@samsiegart samsiegart force-pushed the sam/casting-capdata-errors branch from eca302f to 8f4ba3a Compare November 24, 2023 02:29
@samsiegart samsiegart added the automerge:rebase Automatically rebase updates, then merge label Nov 27, 2023
@mergify mergify bot merged commit 0001c49 into master Nov 27, 2023
77 checks passed
@mergify mergify bot deleted the sam/casting-capdata-errors branch November 27, 2023 18:00
@mhofman mhofman linked an issue Dec 5, 2023 that may be closed by this pull request
mhofman pushed a commit that referenced this pull request Dec 6, 2023
fix(casting): dont crash on bad capdata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Casting follower crashes on invalid capdata
2 participants