Skip to content

Commit

Permalink
Merge pull request #1539 from cosmos/fedekunze/1131-show-err-msgs-only
Browse files Browse the repository at this point in the history
fedekunze/1131 show only err msgs on notifications
  • Loading branch information
faboweb authored Nov 8, 2018
2 parents 7237251 + e87b466 commit 7f190d6
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* [\#1500](https://github.com/cosmos/voyager/issues/1500) Fixed wrong optimistic updates to the atom balance after staking @faboweb @fedekunze
* [\#1517](https://github.com/cosmos/voyager/issues/1517) Fixed wrong account format used for querying selfBond @faboweb
* [\#1503](https://github.com/cosmos/voyager/issues/1503) Added e2e test for balance updates after delegation @faboweb
* [\#1131](https://github.com/cosmos/voyager/issues/1131) Display only error message on notifications @fedekunze
* [\#1440](https://github.com/cosmos/voyager/issues/1440) Fixed an error that prevented disconnecting from the RPC websocket if it wasn't defined @fedekunze

## [0.10.7] - 2018-10-10
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}

function handleCrash(error) {
function handleCrash(err) {
afterBooted(() => {
if (mainWindow) {
mainWindow.webContents.send(`error`, {
message: error
? error.message
? error.message
: error
message: err
? err.message
? err.message
: err
: `An unspecified error occurred`
})
}
Expand Down Expand Up @@ -315,7 +315,7 @@ function stopLCD() {
lcdProcess.kill(`SIGKILL`)
} catch (err) {
handleCrash(err)
reject(`Stopping the LCD resulted in an error: ` + err.message)
reject(`Stopping the LCD resulted in an error: ${err.message}`)
}
})
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/renderer/components/wallet/PageSend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export default {
} catch (err) {
this.sending = false
this.$store.commit(`notifyError`, {
title: `Error Sending`,
body: `An error occurred while trying to send: "${err.message}"`
title: `Error Sending transaction`,
body: err.message
})
}
},
Expand All @@ -181,8 +181,8 @@ export default {
b32.decode(param)
this.bech32error = null
return true
} catch (error) {
this.bech32error = error.message
} catch (err) {
this.bech32error = err.message
return false
}
},
Expand Down
6 changes: 3 additions & 3 deletions app/src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ async function main() {
next()
})

ipcRenderer.on(`error`, (event, error) => {
switch (error.code) {
ipcRenderer.on(`error`, (event, err) => {
switch (err.code) {
case `NO_NODES_AVAILABLE`:
store.commit(`setModalNoNodes`, true)
break
default:
store.commit(`setModalError`, true)
store.commit(`setModalErrorMessage`, error.message)
store.commit(`setModalErrorMessage`, err.message)
}
})
ipcRenderer.on(`approve-hash`, (event, hash) => {
Expand Down
4 changes: 1 addition & 3 deletions app/src/renderer/vuex/modules/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export default ({ node }) => {

function error(err) {
dispatch(`nodeHasHalted`)
console.error(
`Error subscribing to new blocks: ${err.message} ${err.data || ``}`
)
console.error(err.message)
}

node.rpc.status((err, status) => {
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/vuex/modules/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ export default ({ node }) => {

function assertOk(res) {
if (Array.isArray(res)) {
if (res.length === 0) throw new Error(`Error sending transaction.`)
if (res.length === 0) throw new Error(`Error sending transaction`)

return res.forEach(assertOk)
}

if (res.check_tx.code || res.deliver_tx.code) {
let message = res.check_tx.log || res.deliver_tx.log
throw new Error(`Error sending transaction: ` + message)
throw new Error(message)
}
}
4 changes: 2 additions & 2 deletions archive/components/NiVotes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export default {
rootId: this.parent.rootId, // for comments
userUid: this.user.uid
})
.then(null, error => {
.then(null, err => {
this.$store.commit("notifyError", {
title: "Updating vote failed",
body: error.message
body: err.message
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/components/wallet/PageSend.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe(`PageSend`, () => {
node.sign = () => Promise.reject()
await wrapper.vm.onApproved()
expect(store.state.notifications.length).toBe(1)
expect(store.state.notifications[0].title).toBe(`Error Sending`)
expect(store.state.notifications[0].title).toBe(`Error Sending transaction`)
expect(store.state.notifications[0]).toMatchSnapshot()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2056,11 +2056,11 @@ exports[`PageSend should show bech32 error when alphanumeric is wrong 1`] = `

exports[`PageSend should show notification for unsuccessful send 1`] = `
Object {
"body": "An error occurred while trying to send: \\"Error sending transaction: Not enough coins in your account\\"",
"body": "Not enough coins in your account",
"icon": "error",
"layout": "alert",
"time": 42000,
"title": "Error Sending",
"title": "Error Sending transaction",
"type": "error",
}
`;
Expand Down

0 comments on commit 7f190d6

Please sign in to comment.