This repository has been archived by the owner on Sep 3, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display unexpected thrown errors in UI (#146)
* Issue145 try/catch for login, acctLogin errors(invalid mnemonic, privateKey, privateKeyHash), display the error on the ui * code clean - spacing, and convert history.push to routerStore.push for consistency
- Loading branch information
1 parent
61d32f4
commit 3aaeb88
Showing
10 changed files
with
132 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "9.3.0" | ||
- "10.9.0" | ||
|
||
env: | ||
- CXX=g++-4.8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { action, observable } from 'mobx'; | ||
|
||
import AppStore from './AppStore'; | ||
import { MESSAGE_TYPE } from '../../constants'; | ||
|
||
export default class MainContainerStore { | ||
@observable public unexpectedError?: string = undefined; | ||
|
||
private app: AppStore; | ||
|
||
constructor(app: AppStore) { | ||
this.app = app; | ||
} | ||
|
||
@action | ||
public init = () => { | ||
chrome.runtime.onMessage.addListener(this.handleMessage); | ||
} | ||
|
||
@action | ||
private handleMessage = (request: any) => { | ||
const { loginStore, importStore, routerStore }: any = this.app; | ||
switch (request.type) { | ||
case MESSAGE_TYPE.ROUTE_LOGIN: | ||
routerStore.push('/login'); | ||
break; | ||
|
||
case MESSAGE_TYPE.ACCOUNT_LOGIN_SUCCESS: | ||
routerStore.push('/home'); | ||
break; | ||
|
||
case MESSAGE_TYPE.LOGIN_FAILURE: | ||
loginStore.invalidPassword = true; | ||
routerStore.push('/login'); | ||
break; | ||
|
||
case MESSAGE_TYPE.LOGIN_SUCCESS_WITH_ACCOUNTS: | ||
routerStore.push('/account-login'); | ||
break; | ||
|
||
case MESSAGE_TYPE.LOGIN_SUCCESS_NO_ACCOUNTS: | ||
routerStore.push('/create-wallet'); | ||
break; | ||
|
||
case MESSAGE_TYPE.IMPORT_MNEMONIC_PRKEY_FAILURE: | ||
importStore.importMnemonicPrKeyFailed = true; | ||
routerStore.goBack(); | ||
break; | ||
|
||
case MESSAGE_TYPE.UNEXPECTED_ERROR: | ||
if (routerStore.location.pathname === '/loading') { | ||
routerStore.goBack(); | ||
} | ||
this.unexpectedError = request.error; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters