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

Implement SnapError #1833

Merged
merged 22 commits into from
Oct 20, 2023
Merged

Implement SnapError #1833

merged 22 commits into from
Oct 20, 2023

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Oct 10, 2023

This implements the SnapError class, and wrapping/unwrapping of errors thrown from a Snap. SnapErrors will not cause the Snap to crash, and can be used to respond to JSON-RPC requests for example.

Closes #1824.

@Mrtenz Mrtenz mentioned this pull request Oct 11, 2023
@Mrtenz Mrtenz changed the base branch from main to feat/error-handling October 16, 2023 10:07
@Mrtenz Mrtenz force-pushed the mrtenz/snap-error branch from 5be8a5a to e4621d9 Compare October 17, 2023 12:26
@Mrtenz Mrtenz force-pushed the feat/error-handling branch from cbf0102 to 58b1ad9 Compare October 19, 2023 11:24
@Mrtenz Mrtenz force-pushed the mrtenz/snap-error branch from 48d181c to 6e1330d Compare October 19, 2023 11:39
packages/snaps-utils/src/errors.ts Outdated Show resolved Hide resolved
packages/snaps-utils/src/errors.ts Outdated Show resolved Hide resolved
packages/snaps-utils/src/errors.ts Show resolved Hide resolved
packages/snaps-utils/src/errors.ts Outdated Show resolved Hide resolved
@socket-security
Copy link

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: @metamask/[email protected]

@Mrtenz
Copy link
Member Author

Mrtenz commented Oct 20, 2023

@metamaskbot publish-preview

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (58b1ad9) 96.04% compared to head (dbb42f1) 96.11%.

Additional details and impacted files
@@                   Coverage Diff                   @@
##           feat/error-handling    #1833      +/-   ##
=======================================================
+ Coverage                96.04%   96.11%   +0.06%     
=======================================================
  Files                      243      243              
  Lines                     5669     5770     +101     
  Branches                   899      925      +26     
=======================================================
+ Hits                      5445     5546     +101     
  Misses                     224      224              
Files Coverage Δ
...ntrollers/src/services/AbstractExecutionService.ts 90.14% <100.00%> (-0.40%) ⬇️
...ages/snaps-controllers/src/snaps/SnapController.ts 97.55% <100.00%> (+0.01%) ⬆️
...cution-environments/src/common/BaseSnapExecutor.ts 91.83% <100.00%> (+2.87%) ⬆️
...s/snaps-execution-environments/src/common/utils.ts 100.00% <ø> (+6.25%) ⬆️
...ckages/snaps-rpc-methods/src/permitted/getSnaps.ts 100.00% <ø> (ø)
...s/snaps-rpc-methods/src/permitted/invokeKeyring.ts 100.00% <100.00%> (ø)
...snaps-rpc-methods/src/permitted/invokeSnapSugar.ts 100.00% <100.00%> (ø)
...es/snaps-rpc-methods/src/permitted/requestSnaps.ts 96.22% <ø> (ø)
...s/snaps-simulator/src/features/simulation/sagas.ts 74.73% <100.00%> (+1.05%) ⬆️
packages/snaps-utils/src/errors.ts 93.10% <92.66%> (-6.90%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Mrtenz Mrtenz marked this pull request as ready for review October 20, 2023 12:30
@Mrtenz Mrtenz requested a review from a team as a code owner October 20, 2023 12:30
@Mrtenz Mrtenz merged commit 3f374b4 into feat/error-handling Oct 20, 2023
@Mrtenz Mrtenz deleted the mrtenz/snap-error branch October 20, 2023 13:07
Mrtenz added a commit that referenced this pull request Oct 20, 2023
This implements the `SnapError` class, and wrapping/unwrapping of errors
thrown from a Snap. `SnapError`s will not cause the Snap to crash, and
can be used to respond to JSON-RPC requests for example.

Closes #1824.
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.

Implement SnapError
2 participants