Skip to content

Commit da8b1e5

Browse files
authored
Merge pull request #2394 from oasisprotocol/lw/error-module
Include module in error messages
2 parents 56b0cd6 + 0a85703 commit da8b1e5

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

.changelog/2394.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Include module in error messages

src/app/hooks/useTxErrorMessage.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ import { TxError } from '../../oasis-nexus/api'
33

44
export const useTxErrorMessage = (error: TxError | undefined): string | undefined => {
55
const { t } = useTranslation()
6-
if (
7-
!error ||
8-
(!error.module && !error.code) // TODO: This second check shouldn't be necessary. Remove when https://github.com/oasisprotocol/nexus/issues/704 is fixed.
9-
)
6+
if (!error) {
107
return undefined
8+
}
119
if (error.module === 'evm' && error.code === 8 && !error.message && !error.raw_message) {
1210
// EVM reverted, without any message
13-
return `${t('errors.revertedWithoutMessage')} (${t('errors.code')} ${error.code})`
14-
} else {
15-
// Anything else
16-
return `${error.message || error.raw_message} (${t('errors.code')} ${error.code})`
11+
return `${t('errors.revertedWithoutMessage')} (${t('errors.code')} ${error.code}, ${t('errors.module')}: ${error.module})`
1712
}
13+
14+
return `${error.message || error.raw_message} (${t('errors.code')} ${error.code}, ${t('errors.module')}: ${error.module})`
1815
}

0 commit comments

Comments
 (0)