Skip to content

Commit

Permalink
Merge pull request sphinx-labs#693 from chugsplash/pate/fix-yarn-lock
Browse files Browse the repository at this point in the history
feat(core): Add better relayer error handling
  • Loading branch information
RPate97 authored May 18, 2023
2 parents 01c93f2 + bbad489 commit 17c70b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions packages/core/src/metatxs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,20 @@ export const relaySignedRequest = async (
estimatedGasCost: estimatedGasCost.toString(),
})
} catch (e) {
throw new Error(
`Error relaying signed request, are you sure your API key and org ID are correct? + \n ${e.message}`
)
if (e.response?.data?.includes('Unsupported network')) {
throw new Error(`Unsupported network: ${networkId}`)
} else if (e.response?.data?.includes('Unauthorized')) {
throw new Error(
`Unauthorized, are you sure your API key and org ID are correct?`
)
} else if (e.response?.data?.includes('Invalid metatxs request')) {
throw new Error(
`Invalid signature, are you sure your PRIVATE_KEY is correct?`
)
} else {
throw new Error(
`Unknown error, please report this to the developers + \n ${e}`
)
}
}
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3621,9 +3621,9 @@ electron-fetch@^1.7.2:
encoding "^0.1.13"

electron-to-chromium@^1.4.284:
version "1.4.398"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.398.tgz#b0fd3092b07d81c2ebf63f8395aa8a70c2c0892d"
integrity sha512-tT90Lmieb+Y4jX5Awub8BsvuFM/ICKr01oZFBR9Cy6pxCf+rAmwcpRl4xfXb66DzTXc4qSMPqlqLDoghm27utQ==
version "1.4.399"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.399.tgz#df8a63d1f572124ad8b5d846e38b0532ad7d9d54"
integrity sha512-+V1aNvVgoWNWYIbMOiQ1n5fRIaY4SlQ/uRlrsCjLrUwr/3OvQgiX2f5vdav4oArVT9TnttJKcPCqjwPNyZqw/A==

elliptic@6.5.4, elliptic@^6.5.2, elliptic@^6.5.4:
version "6.5.4"
Expand Down

0 comments on commit 17c70b9

Please sign in to comment.