Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
feat(sdk): show error message when relayer is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaWang committed Feb 1, 2020
1 parent 1ee399f commit 02a2255
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ const sendTransaction = async (query, connection) => {
},
responseId,
};
} catch (error) {
} catch (e) {
let error = e;
if (error.message.match(/relayer/)) {
error = {
key: 'transaction.gsn.error.relayer',
fetal: true,
};
}
return {
...query,
data: {
Expand Down
12 changes: 9 additions & 3 deletions packages/extension/src/ui/components/StepContent/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,18 @@ class Footer extends PureComponent {
nextError,
} = this.state;

const error = nextError || currentError || prevError;
let error = nextError || currentError || prevError;
if (!error) {
return null;
}

if (!error.message) {
error = {
...error,
message: i18n.t(error.key, error.response),
};
}

const isFetal = error.fetal;

return (
Expand All @@ -117,8 +124,7 @@ class Footer extends PureComponent {
padding="xs"
>
<Text
text={error.message
|| i18n.t(error.key, error.response)}
text={error.message}
color="red"
size="xxs"
/>
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/src/ui/locales/en/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export default {
explain: 'AZTEC sends transactions through the Gas Station Network so you don\'t pay gas.',
submit: 'Send',
},
error: {
relayer: 'Relayer is not available at the moment. Please try again later.',
},
},
success: 'Transaction completed!',
autoClose: 'This window will close automatically when the transaction is confirmed.',
Expand Down

0 comments on commit 02a2255

Please sign in to comment.