-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show full page error on crash #536
Changes from all commits
c6f9dd4
eace13c
cd72e0b
84c579a
5f8c86b
9468842
31cd55f
f267a74
fc15a89
71d8f25
4d95f19
0b72e27
006e45e
b52f2ea
1cc35ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import Vuelidate from 'vuelidate' | |
import shrinkStacktrace from '../helpers/shrink-stacktrace.js' | ||
import axios from 'axios' | ||
import Raven from 'raven-js' | ||
import {remote} from 'electron' | ||
import { remote } from 'electron' | ||
import enableGoogleAnalytics from './google-analytics.js' | ||
|
||
const config = require('../../../config') | ||
|
@@ -16,6 +16,9 @@ import routes from './routes' | |
import Node from './node' | ||
import Store from './vuex/store' | ||
|
||
// exporting this for testing | ||
let store | ||
|
||
// setup sentry remote error reporting and google analytics | ||
const analyticsEnabled = JSON.parse(remote.getGlobal('process').env.COSMOS_ANALYTICS) | ||
if (analyticsEnabled) { | ||
|
@@ -51,32 +54,37 @@ async function main () { | |
|
||
let relayPort = getQueryParameter('relay_port') | ||
console.log('Expecting relay-server on port:', relayPort) | ||
|
||
console.log('Connecting to node:', nodeIP) | ||
const node = Node(nodeIP, relayPort) | ||
|
||
node.lcdConnected() | ||
.then(connected => { | ||
if (connected) { | ||
axios.get(`http://localhost:${relayPort}/startsuccess`) | ||
} | ||
}) | ||
.then(connected => { | ||
if (connected) { | ||
axios.get(`http://localhost:${relayPort}/startsuccess`) | ||
} | ||
}) | ||
|
||
const router = new Router({ | ||
scrollBehavior: () => ({ y: 0 }), | ||
routes | ||
}) | ||
|
||
const store = Store({ node }) | ||
store = Store({ node }) | ||
|
||
let connected = await store.dispatch('checkConnection') | ||
if (connected) { | ||
store.dispatch('nodeSubscribe') | ||
store.dispatch('showInitialScreen') | ||
store.dispatch('subscribeToBlocks') | ||
let error = getQueryParameter('error') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i find it odd that we have to use url's even in desktop app. anyone have any thoughts on this? not a big deal, just a curiosity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this is the easiest solution. We can/should switch to a socket communication between the main thread and the browser. |
||
if (error) { | ||
store.commit('setModalError', true) | ||
store.commit('setModalErrorMessage', error) | ||
} else { | ||
let connected = await store.dispatch('checkConnection') | ||
if (connected) { | ||
store.dispatch('nodeSubscribe') | ||
store.dispatch('showInitialScreen') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean that if you get the full screen error, you have to sign back in 100% of the time? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The full page error will block you from doing anything but close the application. So you have to sign back in the next time. |
||
store.dispatch('subscribeToBlocks') | ||
} | ||
} | ||
|
||
return new Vue({ | ||
new Vue({ | ||
router, | ||
...App, | ||
store | ||
|
@@ -85,6 +93,9 @@ async function main () { | |
|
||
main().catch(function (err) { throw err }) | ||
|
||
// exporting this for testing | ||
module.exports.store = store | ||
|
||
function getQueryParameter (name) { | ||
let queryString = window.location.search.substring(1) | ||
let pairs = queryString.split('&') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,13 +43,14 @@ export default function ({ node }) { | |
dispatch('reconnected') | ||
} | ||
}, | ||
nodeSubscribe ({commit, dispatch}) { | ||
async nodeSubscribe ({commit, dispatch}) { | ||
if (state.stopConnecting) return | ||
|
||
// the rpc socket can be closed before we can even attach a listener | ||
// so we remember if the connection is open | ||
// we handle the reconnection here so we can attach all these listeners on reconnect | ||
if (!node.rpcOpen) { | ||
await sleep(500) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was needed so the process isn't blocked while continuously trying to reconnect. |
||
dispatch('reconnect') | ||
return | ||
} | ||
|
@@ -119,3 +120,7 @@ export default function ({ node }) { | |
|
||
return { state, mutations, actions } | ||
} | ||
|
||
function sleep (ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am in favour of these stylistic changes, but we should consider (agreeing on and) using a linter so no one changes this back / future styles are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
vs code was messed up for a moment and reformatted stuff. Wrote in the chat about agreeing on one rule.