Skip to content

Implement SnapError - #1833

Merged
Mrtenz merged 22 commits into
feat/error-handlingfrom
mrtenz/snap-error
Oct 20, 2023
Merged

Implement SnapError#1833
Mrtenz merged 22 commits into
feat/error-handlingfrom
mrtenz/snap-error

Conversation

@Mrtenz

@MrtenzMrtenz commented Oct 10, 2023

Copy link
Copy Markdown
Member

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.

@MrtenzMrtenz mentioned this pull request Oct 11, 2023
@Mrtenz
Mrtenz changed the base branch from main to feat/error-handlingOctober 16, 2023 10:07
@Mrtenz
Mrtenzforce-pushed the feat/error-handling branch from cbf0102 to 58b1ad9CompareOctober 19, 2023 11:24
Comment threadpackages/snaps-controllers/src/snaps/SnapController.test.ts Outdated
Comment threadpackages/snaps-controllers/src/snaps/SnapController.test.ts Outdated
Comment threadpackages/snaps-utils/src/errors.ts Outdated
Comment threadpackages/snaps-utils/src/errors.ts Outdated
Comment threadpackages/snaps-utils/src/errors.ts
Comment threadpackages/snaps-execution-environments/src/common/BaseSnapExecutor.ts Outdated
Comment threadpackages/snaps-utils/src/errors.ts Outdated
@socket-security

Copy link
Copy Markdown

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

🚮 Removed packages:@metamask/rpc-errors@5.1.1

Comment threadpackages/snaps-controllers/src/snaps/SnapController.test.ts
Comment threadpackages/snaps-controllers/src/snaps/SnapController.ts
@Mrtenz

Copy link
Copy Markdown
MemberAuthor

@metamaskbot publish-preview

@codecov

codecovBot commented Oct 20, 2023

Copy link
Copy Markdown

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 
FilesCoverage Δ
...ntrollers/src/services/AbstractExecutionService.ts90.14% <100.00%> (-0.40%)⬇️
...ages/snaps-controllers/src/snaps/SnapController.ts97.55% <100.00%> (+0.01%)⬆️
...cution-environments/src/common/BaseSnapExecutor.ts91.83% <100.00%> (+2.87%)⬆️
...s/snaps-execution-environments/src/common/utils.ts100.00% <ø> (+6.25%)⬆️
...ckages/snaps-rpc-methods/src/permitted/getSnaps.ts100.00% <ø> (ø)
...s/snaps-rpc-methods/src/permitted/invokeKeyring.ts100.00% <100.00%> (ø)
...snaps-rpc-methods/src/permitted/invokeSnapSugar.ts100.00% <100.00%> (ø)
...es/snaps-rpc-methods/src/permitted/requestSnaps.ts96.22% <ø> (ø)
...s/snaps-simulator/src/features/simulation/sagas.ts74.73% <100.00%> (+1.05%)⬆️
packages/snaps-utils/src/errors.ts93.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 ownerOctober 20, 2023 12:30
@Mrtenz
Mrtenz merged commit 3f374b4 into feat/error-handlingOct 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 freeto 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

@Mrtenz@FrederikBolding