fix(builder): Error passthrough on rpc errors #1324
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Any errors that happen while trying to communicate with the RPC during read operations on optimism were being skipped, which is why the fallback registry would try mainnet even though it may result in fetching the wrong package info.
Adding a throw statement resulted in the RPC error being thrown when a read operation fails due to an RPC issue.
fixes https://linear.app/usecannon/issue/CAN-470/differentiate-errors-better-on-the-fallback-registry
Examples:
Package only on Ethereum mainnet throws rpc error if there is one:
https://www.loom.com/share/bfea17e267f4436395dcdac94e2afd9d
Package only on Ethereum mainnet throws rpc error if there is one:
https://www.loom.com/share/393264be32cd44bcbb499e800521d0aa
Package on both networks does not fall back to eth mainnet if theres an rpc error:
https://www.loom.com/share/e064960836264851aa8ffe63f1ab3dd2
Ive confirmed that all the packages are resolved correctly and the fallback behaviour now works ONLY if the package is not found (aka returns empty string)