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

Don't show TX error messages for empty error blocks #1444

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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/1444.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't show TX error messages for empty error blocks
2 changes: 1 addition & 1 deletion src/app/components/StatusIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const StatusIcon: FC<StatusIconProps> = ({ success, error, withText }) =>
&nbsp;
{statusIcon[status]}
</StyledBox>
{error && <ErrorBox>{errorMessage}</ErrorBox>}
{errorMessage && <ErrorBox>{errorMessage}</ErrorBox>}
</>
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/app/hooks/useTxErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TxError } from '../../oasis-nexus/api'

export const useTxErrorMessage = (error: TxError | undefined): string | undefined => {
const { t } = useTranslation()
if (!error) return undefined
if (!error || (!error.module && !error.code)) return undefined
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why check for a module? I think simplification should suffice:

Suggested change
if (!error || (!error.module && !error.code)) return undefined
if (!error?.code) return undefined

Copy link
Contributor Author

@csillag csillag Jun 5, 2024

Choose a reason for hiding this comment

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

Why check for a module?

Because I don't know if we can assume that all possible modules (i.e. sources of errors) are sane enough to use the 0 error code for success.

There might be some deranged modules that break the convention.

Generally speaking, when hiding error messages, I want to be as narrow and specific as possible. We know that no module and error code 0 is not a problem, so we can hide this, but nothing else.

If we see more useless error messages later, we can also hide them later...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add a TODO, if this ever gets resolved upstream.

if (error.module === 'evm' && error.code === 8 && !error.message) {
// EVM reverted, with missing error message
return `${t('errors.revertedWithoutMessage')} (${t('errors.code')} ${error.code})`
Expand Down
Loading