Skip to content

Commit

Permalink
feat: log errorss to consolve when showing error notification (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechsimetka committed Jul 25, 2022
1 parent feeca00 commit 6bfe97b
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/CashoutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default function CheckoutModal({ peerId, uncashedAmount }: Props): ReactE
)
})
.catch((e: Error) => {
console.error(e) // eslint-disable-line
enqueueSnackbar(<span>Error: {e.message}</span>, { variant: 'error' })
})
.finally(() => {
Expand Down
1 change: 1 addition & 0 deletions src/components/WithdrawDepositModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function WithdrawDepositModal({
setOpen(false)
enqueueSnackbar(`${successMessage} Transaction ${transactionHash}`, { variant: 'success' })
} catch (e) {
console.error(e) // eslint-disable-line
enqueueSnackbar(`${errorMessage} Error: ${(e as Error).message}`, { variant: 'error' })
}
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/files/Download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function Download(): ReactElement {
if (message.includes('Not Found: Not Found')) {
message = 'The specified hash was not found.'
}
console.error(error) // eslint-disable-line
enqueueSnackbar(<span>Error: {message || 'Unknown'}</span>, { variant: 'error' })
} finally {
setLoading(false)
Expand Down
1 change: 1 addition & 0 deletions src/pages/files/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export function Upload(): ReactElement {
}
})
.catch(e => {
console.error(e) // eslint-disable-line
enqueueSnackbar(`Error uploading: ${e.message}`, { variant: 'error' })
setUploading(false)
})
Expand Down
1 change: 1 addition & 0 deletions src/pages/gift-code/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function Index(): ReactElement {
await createGiftWallet(wallet.address)
enqueueSnackbar('Succesfully funded gift wallet', { variant: 'success' })
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to fund gift wallet: ${error}`, { variant: 'error' })
} finally {
setLoading(false)
Expand Down
1 change: 1 addition & 0 deletions src/pages/stamps/PostageStampCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export function PostageStampCreation({ onFinished }: Props): ReactElement {
await refresh()
onFinished()
} catch (e) {
console.error(e) // eslint-disable-line
enqueueSnackbar(`Error: ${(e as Error).message}`, { variant: 'error' })
actions.setSubmitting(false)
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/top-up/GiftCardFund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function GiftCardFund(): ReactElement {
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
navigate(ROUTES.RESTART_LIGHT)
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to upgrade: ${error}`, { variant: 'error' })
}
}
Expand All @@ -72,6 +73,7 @@ export function GiftCardFund(): ReactElement {

if (canUpgradeToLightNode) await restart()
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to fund: ${error}`, { variant: 'error' })
} finally {
setLoading(false)
Expand Down
1 change: 1 addition & 0 deletions src/pages/top-up/GiftCardTopUpIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function GiftCardTopUpIndex(): ReactElement {
enqueueSnackbar('Successfully verified gift wallet', { variant: 'success' })
navigate(ROUTES.TOP_UP_GIFT_CODE_FUND.replace(':privateKeyString', giftCode))
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Gift wallet could not be verified: ${error}`, { variant: 'error' })
} finally {
setLoading(false)
Expand Down
2 changes: 2 additions & 0 deletions src/pages/top-up/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export function Swap({ header }: Props): ReactElement {
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
navigate(ROUTES.RESTART_LIGHT)
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to upgrade: ${error}`, { variant: 'error' })
}
}
Expand All @@ -101,6 +102,7 @@ export function Swap({ header }: Props): ReactElement {

if (canUpgradeToLightNode) await restart()
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to swap: ${error}`, { variant: 'error' })
} finally {
balance?.refresh()
Expand Down
1 change: 1 addition & 0 deletions src/pages/top-up/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function TopUp(): ReactElement {
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
navigate(ROUTES.RESTART_LIGHT)
} catch (error) {
console.error(error) // eslint-disable-line
enqueueSnackbar(`Failed to upgrade: ${error}`, { variant: 'error' })
}
setLoading(false)
Expand Down

0 comments on commit 6bfe97b

Please sign in to comment.