Skip to content
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

Fabo/1573 sent errors via raven #1624

Merged
merged 6 commits into from
Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1564](https://github.com/cosmos/voyager/issues/1564) Add support to query governance proposals on `lcdClient(Mock).js` @fedekunze
- [\#1544](https://github.com/cosmos/voyager/issues/1544) Added eslint-plugin-vue for cleaner vue files @jbibla
- [\#1611](https://github.com/cosmos/voyager/issues/1611) added no testnet warning @faboweb
- [\#1573](https://github.com/cosmos/voyager/issues/1573) added remote error collection for several catched errors in Voyager @faboweb

### Changed

Expand Down
3 changes: 3 additions & 0 deletions app/src/renderer/vuex/modules/blockchain.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Raven from "raven-js"

export default ({ node }) => {
const state = {
blockMetaInfo: { block_id: {} },
Expand Down Expand Up @@ -65,6 +67,7 @@ export default ({ node }) => {
title: `Error fetching block information`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.loading = false
state.error = err
return null
Expand Down
10 changes: 7 additions & 3 deletions app/src/renderer/vuex/modules/connection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict"

import { ipcRenderer, remote } from "electron"
import Raven from "raven-js"
import { sleep } from "scripts/common.js"

const config = remote.getGlobal(`config`)
Expand Down Expand Up @@ -92,6 +91,7 @@ export default function({ node }) {
{ query: `tm.event = 'NewBlockHeader'` },
(err, event) => {
if (err) {
Raven.captureException(err)
faboweb marked this conversation as resolved.
Show resolved Hide resolved
return console.error(`error subscribing to headers`, err)
}
dispatch(`setLastHeader`, event.data.value.header)
Expand Down Expand Up @@ -148,7 +148,11 @@ export default function({ node }) {
}
}, timeout)
node.rpc.status(err => {
if (err) return console.error(`Couldn't get status via RPC:`, err)
if (err) {
faboweb marked this conversation as resolved.
Show resolved Hide resolved
Raven.captureException(err)
console.error(`Couldn't get status via RPC:`, err)
return
}

state.nodeTimeout = null
state.connected = true
Expand Down
5 changes: 3 additions & 2 deletions app/src/renderer/vuex/modules/delegates.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict"

import Raven from "raven-js"
import BN from "bignumber.js"
import { ratToBigNumber } from "scripts/common"
import num from "scripts/num"
import { isEmpty } from "lodash"
import b32 from "scripts/b32"

export default ({ node }) => {
const emptyState = {
delegates: [],
Expand Down Expand Up @@ -100,6 +100,7 @@ export default ({ node }) => {
title: `Error fetching validators`,
body: err.message
})
Raven.captureException(err)
faboweb marked this conversation as resolved.
Show resolved Hide resolved
commit(`setDelegateLoading`, false)
state.error = err
return []
Expand Down
5 changes: 3 additions & 2 deletions app/src/renderer/vuex/modules/delegation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict"

import Raven from "raven-js"
import { calculateShares } from "scripts/common"

export default ({ node }) => {
let emptyState = {
loading: false,
Expand Down Expand Up @@ -145,6 +145,7 @@ export default ({ node }) => {
title: `Error fetching delegations`,
body: err.message
})
Raven.captureException(err)
faboweb marked this conversation as resolved.
Show resolved Hide resolved
state.error = err
}

Expand Down
2 changes: 0 additions & 2 deletions app/src/renderer/vuex/modules/filters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict"

export default () => {
const emptyState = {
balances: {
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/vuex/modules/governance/deposits.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
import Raven from "raven-js"

export default ({ node }) => {
const state = {
Expand All @@ -24,6 +24,7 @@ export default ({ node }) => {
title: `Error fetching deposits on proposals`,
body: err.message
})
Raven.captureException(err)
state.error = err
}
state.loading = false
Expand Down
3 changes: 3 additions & 0 deletions app/src/renderer/vuex/modules/governance/parameters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Raven from "raven-js"

export default ({ node }) => {
const emptyState = {
govParameters: {
Expand Down Expand Up @@ -30,6 +32,7 @@ export default ({ node }) => {
title: `Error fetching governance parameters`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
state.loading = false
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/vuex/modules/governance/proposals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
import Raven from "raven-js"
import Vue from "vue"

export default ({ node }) => {
Expand Down Expand Up @@ -39,6 +39,7 @@ export default ({ node }) => {
title: `Error fetching proposals`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
state.loading = false
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/vuex/modules/governance/votes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
import Raven from "raven-js"

export default ({ node }) => {
const state = {
Expand All @@ -24,6 +24,7 @@ export default ({ node }) => {
title: `Error fetching votes`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
state.loading = false
Expand Down
2 changes: 2 additions & 0 deletions app/src/renderer/vuex/modules/keybase.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from "axios"
import Raven from "raven-js"

export default ({}) => {
const emptyState = {
Expand Down Expand Up @@ -57,6 +58,7 @@ export default ({}) => {
title: `Error fetching keybase information for validators`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/renderer/vuex/modules/parameters.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Raven from "raven-js"

export default ({ node }) => {
const emptyState = {
parameters: {},
Expand All @@ -23,6 +25,7 @@ export default ({ node }) => {
title: `Error fetching staking parameters`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
state.loading = false
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/vuex/modules/pool.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
import Raven from "raven-js"

export default ({ node }) => {
const emptyState = {
Expand Down Expand Up @@ -30,6 +30,7 @@ export default ({ node }) => {
title: `Error fetching staking pool information`,
body: err.message
})
Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

state.error = err
}
state.loading = false
Expand Down
2 changes: 0 additions & 2 deletions app/src/renderer/vuex/modules/send.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict"

export default ({ node }) => {
let lock = null

Expand Down
62 changes: 27 additions & 35 deletions app/src/renderer/vuex/modules/transactions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fp = require(`lodash/fp`)
import fp from "lodash/fp"
import { uniqBy } from "lodash"
import Raven from "raven-js"
export default ({ node }) => {
let emptyState = {
loading: false,
Expand All @@ -26,9 +27,6 @@ export default ({ node }) => {
setHistoryLoading(state, loading) {
state.loading = loading
},
setError(state, error) {
state.error = error
},
setTransactionTime(state, { blockHeight, blockMetaInfo }) {
txCategories.forEach(category => {
state[category].forEach(t => {
Expand All @@ -50,10 +48,10 @@ export default ({ node }) => {
await dispatch(`getAllTxs`)
}
},
async getAllTxs({ commit, dispatch }) {
commit(`setHistoryLoading`, true)

async getAllTxs({ commit, dispatch, state }) {
try {
commit(`setHistoryLoading`, true)

const stakingTxs = await dispatch(`getTx`, `staking`)
commit(`setStakingTxs`, stakingTxs)

Expand All @@ -68,45 +66,39 @@ export default ({ node }) => {
transactions: allTxs
})
} catch (error) {
commit(`setError`, error.message.slice(0))
commit(`notifyError`, {
title: `Error getting transactions`,
body: error.message
})
Raven.captureException(error)
state.error = error
}
commit(`setHistoryLoading`, false)
},
async getTx(
{
rootState: {
user: { address }
},
commit
}
},
type
) {
try {
let response
switch (type) {
case `staking`:
response = await node.getDelegatorTxs(address)
break
case `governance`:
response = await node.getGovernanceTxs(address)
break
case `wallet`:
response = await node.txs(address)
break
default:
throw new Error(`Unknown transaction type`)
}
state.error = null
const transactionsPlusType = response.map(fp.set(`type`, type))
return response ? uniqBy(transactionsPlusType, `hash`) : []
} catch (err) {
commit(`notifyError`, {
title: `Error fetching ${type} transactions`,
body: err.message
})
state.error = err
return []
let response
switch (type) {
case `staking`:
response = await node.getDelegatorTxs(address)
break
case `governance`:
response = await node.getGovernanceTxs(address)
break
case `wallet`:
response = await node.txs(address)
break
default:
throw new Error(`Unknown transaction type`)
}
const transactionsPlusType = response.map(fp.set(`type`, type))
return response ? uniqBy(transactionsPlusType, `hash`) : []
},
async enrichTransactions({ dispatch }, { transactions }) {
const blockHeights = new Set(transactions.map(({ height }) => height))
Expand Down
16 changes: 10 additions & 6 deletions app/src/renderer/vuex/modules/user.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"use strict"

import enableGoogleAnalytics from "../../google-analytics.js"
import Raven from "raven-js"
const { ipcRenderer, remote } = require(`electron`)
import { ipcRenderer, remote } from "electron"
import enableGoogleAnalytics from "../../google-analytics.js"
const config = remote.getGlobal(`config`)

export default ({ node }) => {
Expand All @@ -18,7 +16,8 @@ export default ({ node }) => {
account: null,
address: null,
errorCollection: false,
stateLoaded: false // shows if the persisted state is already loaded. used to prevent overwriting the persisted state before it is loaded
stateLoaded: false, // shows if the persisted state is already loaded. used to prevent overwriting the persisted state before it is loaded
error: null
}

const mutations = {
Expand Down Expand Up @@ -61,15 +60,20 @@ export default ({ node }) => {
dl: `/session/` + screen
})
},
async loadAccounts({ commit }) {
async loadAccounts({ commit, state }) {
state.loading = true
try {
let keys = await node.keys.values()
commit(`setAccounts`, keys)
} catch (err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

Raven.captureException(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error

commit(`notifyError`, {
title: `Couldn't read keys`,
body: err.message
})
state.error = err
} finally {
state.loading = false
}
},
async testLogin(state, { password, account }) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/vuex/modules/validators.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict"
import Raven from "raven-js"

export default ({ node }) => {
const emptyState = {
Expand Down Expand Up @@ -39,6 +39,7 @@ export default ({ node }) => {
title: `Error fetching validator set`,
body: err.message
})
Raven.captureException(err)
state.error = err
}
state.loading = false
Expand Down
Loading