Skip to content

Commit

Permalink
DEV-574 Network Error (#197)
Browse files Browse the repository at this point in the history
- Added individual codes for network errors
- Cleaned up some of the code so to use the errorCode variable
- Added shell changes to match network errors
  • Loading branch information
thedigitaldesign authored and dsarfati committed Oct 1, 2019
1 parent 0b8f28f commit 619d12b
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 16 deletions.
16 changes: 9 additions & 7 deletions packages/desktop-app/src/Ethminer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,26 @@ export class Ethminer {
// Anti-Virus
{ error: 'is not recognized as an internal or external command', code: 314159265 },
{ error: 'The system cannot find the path specified', code: 314159265 },
{ error: 'Socket write failed', code: 314159265 },
// CUDA
{ error: '3221225595', code: 8675309 },
{ error: '3221225781', code: 8675309 },
{ error: 'CUDA error: Insufficient CUDA driver: 9', code: 8675309 },
{ error: 'CUDA error: Insufficient CUDA driver: 7050', code: 8675309 },
{ error: 'CUDA error in func', code: 8675309 },
{ error: 'No OpenCL platforms found', code: 8675309 },
// Nonce
{ error: 'Invalid nonce', code: 9998 },
// Unknown
{ error: 'stratum Error', code: 9999 },
{ error: 'exit: 0', code: 9999 },
// Network Errors
{ error: 'Network Error', code: 9999 },
{ error: 'No connection', code: 9999 },
// Nonce
{ error: 'Invalid nonce', code: 9998 },
// No modal errors
{ error: 'exit: 1', code: 8888 },
// Network Errors
{ error: 'Network Error', code: 4000 },
{ error: 'stratum Error', code: 4001 },
{ error: 'stratum Error', code: 4001 },
{ error: 'Socket read failed', code: 4002 },
{ error: 'Socket write failed', code: 4003 },
{ error: 'No connection', code: 4004 },
]

errors.map(item => {
Expand Down
10 changes: 8 additions & 2 deletions packages/web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ import {
import { AccountModalContainer } from './modules/profile-views'
import { AnimatedSwitch } from './components/AnimatedSwitch'
import { CompatibilityCheckPageContainer } from './modules/machine-views'
import { CudaErrorContainer, UnknownErrorContainer, AntiVirusErrorContainer } from './modules/error-views'
import {
AntiVirusErrorContainer,
CudaErrorContainer,
NetworkErrorContainer,
UnknownErrorContainer,
} from './modules/error-views'
// Settings Menu
import { SettingsContainer } from './modules/settings-views'
// Account Menu
Expand Down Expand Up @@ -143,8 +148,9 @@ const Auth = () => {
return (
<>
<Route path="/" render={() => <HomePage />} />
<Route exact path="/errors/cuda" component={CudaErrorContainer} />
<Route exact path="/errors/anti-virus" component={AntiVirusErrorContainer} />
<Route exact path="/errors/cuda" component={CudaErrorContainer} />
<Route exact path="/errors/network" component={NetworkErrorContainer} />
<Route exact path="/errors/unknown" component={UnknownErrorContainer} />
<Route exact path="/rewards/:id" component={RewardDetailsModalContainer} />
<Route exact path="/rewards/:id/redeem" component={RewardRedemptionModalContainer} />
Expand Down
14 changes: 14 additions & 0 deletions packages/web-app/src/modules/error-views/NetworkErrorContainer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { connect } from '../../connect'
import { RootStore } from '../../Store'
import { NetworkErrorPage } from './components/NetworkErrorPage'

const mapStoreToProps = (store: RootStore) => ({
onCloseClicked: () => store.ui.hideModal(),
onSendLog: store.native.sendLog,
showSendLog: store.native.canSendLogs,
})

export const NetworkErrorContainer = connect(
mapStoreToProps,
NetworkErrorPage,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { Component } from 'react'

// Components
import { ErrorPage } from '../../../components/ErrorPage'

interface Props {
onCloseClicked?: () => void
showSendLog?: boolean
onSendLog?: () => void
}

export class NetworkErrorPage extends Component<Props> {
handleSendLogClicked = () => {
const { onSendLog } = this.props

if (onSendLog) onSendLog()
}

render() {
const { showSendLog, onCloseClicked } = this.props

return (
<ErrorPage
title="Network Error X_x"
onCloseClicked={onCloseClicked}
showSendLog={showSendLog}
onSendLog={this.handleSendLogClicked}
>
<div>It appears this we are having trouble connecting to the Salad mining pool.</div>
</ErrorPage>
)
}
}
6 changes: 4 additions & 2 deletions packages/web-app/src/modules/error-views/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './UnknownErrorContainer'
export * from './CudaErrorContainer'
export * from './AntiVirusErrorContainer'
export * from './CudaErrorContainer'
export * from './NetworkErrorContainer'
export * from './UnknownErrorContainer'

18 changes: 13 additions & 5 deletions packages/web-app/src/modules/machine/NativeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,31 @@ export class NativeStore {
console.log('Error code: ', errorCode)

switch (errorCode) {
case 8675309: // Tommy Tutone - 867-5309/Jenny: https://youtu.be/6WTdTwcmxyo
this.restartMiner()
case 8675309: // CUDA - Tommy Tutone - 867-5309/Jenny: https://youtu.be/6WTdTwcmxyo
store.ui.showModal('/errors/cuda')
store.analytics.captureException(new Error(`Received CUDA error code ${errorCode} from native`))
store.analytics.track('CUDA Error', { ErrorCode: errorCode })
break
case 314159265: // Pie!
case 314159265: // Anti-virus - Pie!
store.ui.showModal('/errors/anti-virus')
store.analytics.captureException(new Error(`Received Anti-Virus error code ${errorCode} from native`))
store.analytics.track('Anti-Virus Error', { ErrorCode: errorCode })
this.stop()
break
case 4000: // Network errors
case 4001:
case 4002:
case 4003:
case 4004:
store.ui.showModal('/errors/network')
this.restartMiner()
store.analytics.track('Network Error', { ErrorCode: errorCode })
break
case 8888: // Generic, ethminer.exe terminated, no modal error message
store.analytics.track('Ethminer.exe Stopped', { ErrorCode: 8888 })
store.analytics.track('Ethminer.exe Stopped', { ErrorCode: errorCode })
this.stop()
break
case 9998:
case 9998: // Nonce
this.restartMiner()
store.analytics.captureException(new Error(`Received Nonce error code ${errorCode} from native`))
store.analytics.track('Nonce Unknown Error', { ErrorCode: errorCode })
Expand Down

0 comments on commit 619d12b

Please sign in to comment.