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

Log unknown swap errors #623

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Log unknown swap errors #623

merged 1 commit into from
Oct 25, 2024

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Oct 24, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

@samholmes samholmes force-pushed the sam/log-unknown-swap-errors branch from 625859d to 898fa54 Compare October 24, 2024 01:11
Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

Two small cleanups, but what's here would work.

Comment on lines 253 to 256
function isUnknownSwapError(error: unknown): boolean {
return (
asMaybeInsufficientFundsError(error) == null &&
asMaybePendingFundsError(error) == null &&
asMaybeSwapAboveLimitError(error) == null &&
asMaybeSwapBelowLimitError(error) == null &&
asMaybeSwapPermissionError(error) == null &&
asMaybeSwapCurrencyError(error) == null
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of building this whole new function, could we use rankError(error) <= 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, hmm.. The functions are semantically different and their is motivation for them to diverge in the future as we filter out noisy errors. Shall we opt to keep them distinct for this reason?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we give the error a score, then we know what it is, and by definition the error cannot be "unknown". Let's leverage this fact, but still keep the functions distinct:

function isUnknownSwapError(error: unknown): boolean {
  isKnownError = rankError(error) > 1
  return !isKnownError
}

// Stringify to include "null"
toToken: String(request.toTokenId),
toWalletType: request.toWallet.type,
// toWalletType: request.fromWallet.type,
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover comment?

@samholmes samholmes force-pushed the sam/log-unknown-swap-errors branch from 898fa54 to 0fefaa4 Compare October 25, 2024 23:00
@samholmes samholmes merged commit 6822ea4 into master Oct 25, 2024
2 checks passed
@samholmes samholmes deleted the sam/log-unknown-swap-errors branch October 25, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants