Skip to content

Commit

Permalink
fix(DataError): if given an error, handle DataError string
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed May 13, 2019
1 parent 388f200 commit ded3cc4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const MessageText = styled(Text)`
const ErrorHandler = props => {
const { message, onClick } = props
const e2e = props['data-e2e']
const errorMessage = prop('message', message)
const errorMessage = prop('message', message) || prop('description', message)
const vulnerableAddress = checkForVulnerableAddressError(message)

if (vulnerableAddress) {
Expand Down Expand Up @@ -42,6 +42,12 @@ const ErrorHandler = props => {
/>
</Text>
)
} else if (typeof errorMessage === 'string') {
return (
<Text size='16px' color='error' weight={500}>
{errorMessage}
</Text>
)
} else {
return (
<TextGroup inline>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { actions, selectors } from 'data'
export default () => {
const refreshClicked = function * () {
try {
// User
yield put(actions.modules.profile.fetchUser())
// Data (balance)
yield put(actions.core.data.bch.fetchData())
yield put(actions.core.data.btc.fetchData())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const StepHeader = styled(ModalHeader)`
margin-right: 42px;
}
`
const ErrorHeader = styled(ModalHeader)`
border-bottom: 0px;
`
const IdentityVerificationTray = styled(Tray)`
margin-top: 0;
border-radius: 0;
Expand Down Expand Up @@ -225,7 +228,15 @@ class IdentityVerification extends React.PureComponent {
),
Loading: () => <Loading />,
NotAsked: () => <Loading />,
Failure: () => <DataError onClick={this.initializeVerification} />
Failure: error => (
<React.Fragment>
<ErrorHeader onClose={this.handleClose} />
<DataError
onClick={this.initializeVerification}
message={error}
/>
</React.Fragment>
)
})}
</IdentityVerificationTray>
)
Expand Down

0 comments on commit ded3cc4

Please sign in to comment.