-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor wallet connect error handling (#2179)
* chore: improve wallet connect error handling * Update packages/shared/src/lib/auxiliary/wallet-connect/utils/getBloomError.ts Co-authored-by: Mark Nardi <[email protected]> * chore: update imports --------- Co-authored-by: Mark Nardi <[email protected]>
- Loading branch information
Showing
5 changed files
with
25 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/shared/src/lib/auxiliary/wallet-connect/utils/getBloomError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { CallbackParameters } from '@auxiliary/wallet-connect/types' | ||
import { getSdkError } from '@walletconnect/utils' | ||
import { IError } from '@core/error/interfaces' | ||
|
||
export function getBloomError(err: unknown): Omit<CallbackParameters, 'result'> { | ||
try { | ||
// @ts-expect-error the error types aren't exported from @walletconnect | ||
return { error: getSdkError(err) } | ||
} catch { | ||
return { | ||
error: { | ||
message: (err as IError).message ?? 'Something went wrong', | ||
code: 1000, | ||
}, | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/shared/src/lib/auxiliary/wallet-connect/utils/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters