-
-
Notifications
You must be signed in to change notification settings - Fork 242
fix: handle snaps error #6104
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: handle snaps error #6104
Conversation
d891711
to
2a9bbd0
Compare
...es/assets-controllers/src/MultichainAssetsRatesController/MultichainAssetsRatesController.ts
Outdated
Show resolved
Hide resolved
...es/assets-controllers/src/MultichainAssetsRatesController/MultichainAssetsRatesController.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Snap Request Handling Bypass Causes Errors
The fetchHistoricalPricesForAsset
method bypasses the new #handleSnapRequest
method, directly calling messagingSystem.call
. This prevents graceful error handling (logging and returning undefined
) for historical price requests, unlike other snap requests, potentially causing crashes and contradicting the PR's goal of improved error handling for all snap requests.
packages/assets-controllers/src/MultichainAssetsRatesController/MultichainAssetsRatesController.ts#L424-L440
Lines 424 to 440 in 1e2009d
try { | |
const historicalPricesResponse = await this.messagingSystem.call( | |
'SnapController:handleRequest', | |
{ | |
snapId: selectedAccount?.metadata.snap?.id as SnapId, | |
origin: 'metamask', | |
handler: HandlerType.OnAssetHistoricalPrice, | |
request: { | |
jsonrpc: '2.0', | |
method: HandlerType.OnAssetHistoricalPrice, | |
params: { | |
from: asset, | |
to: currentCaipCurrency, | |
}, | |
}, | |
}, | |
); |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Explanation
The
MultichainAssetsRatesController
was experiencing crashes when Snap requests failed due to parameter validation errors.the error handling was insufficient - when Snap requests failed, the controller will send a sentry error rather than gracefully handling the error and continuing operation.
References
Changelog
Checklist