Skip to content

Commit

Permalink
Forward error messages from parser module to adalite
Browse files Browse the repository at this point in the history
  • Loading branch information
xdzurman committed Oct 28, 2020
1 parent bde58b6 commit 5c809e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/frontend/actions.ts
Expand Up @@ -1177,9 +1177,7 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
const deserializedTx = deserializeTransactionFile(fileJson)
const deserializedTxValidationError = validatePoolRegUnsignedTx(deserializedTx)
if (deserializedTxValidationError) {
setErrorState('poolRegTxError', deserializedTxValidationError)
stopLoadingAction(state, {})
return
throw deserializedTxValidationError
}
const ownerCredentials = await wallet.getPoolOwnerCredentials()
console.log('CREDENTIALS', ownerCredentials)
Expand All @@ -1195,6 +1193,10 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
})
stopLoadingAction(state, {})
} catch (err) {
// err from parser
if (err.name === 'Error') {
err.name = 'PoolRegTxParserError'
}
debugLog(`Certificate file parsing failure: ${err}`)
stopLoadingAction(state, {})
setErrorState('poolRegTxError', err)
Expand Down
1 change: 1 addition & 0 deletions app/frontend/translations.ts
Expand Up @@ -103,6 +103,7 @@ const translations = {
PoolRegNoHwWallet: () => {
'Only hardware wallet users can use this feature.'
},
PoolRegTxParserError: ({message}) => `Parser error: ${message}`,
}

function getTranslation(code, params = {}) {
Expand Down

0 comments on commit 5c809e9

Please sign in to comment.