-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: unsupported transaction error fallback #823
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
408e367
to
3719405
Compare
3719405
to
377a6bb
Compare
9302e10
to
2becc0b
Compare
2becc0b
to
d86b896
Compare
* Failed Query results (i.e., those starting with "Query failed") are matched via the error message, defaulting to "Unknown query result error". | ||
* Unmatched errors will display the actual error message. | ||
*/ | ||
export const stringifyTransactionError = (error: any): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] does broadcasterror cover all abacus cases? i'm curious as to whether or not this will also fix the onboarding/offboarding modal errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where transaction errors are parsed!
that specific error in the slack channel is a broadcast error, so i think it's just because it wasn't passed through that function
src/hooks/useSubaccount.tsx
Outdated
@@ -375,7 +376,7 @@ const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: LocalWall | |||
if (success) { | |||
onSuccess?.(data); | |||
} else { | |||
onError?.({ errorStringKey: parsingError?.stringKey }); | |||
onError?.(getValidParsingErrorParams(parsingError)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] should this function be named getValidOnErrorParamsFromParsingError
? since what we're getting is the onErrorParams
from the parsing error?
fe28a1b
to
d4125e2
Compare
context: it's possible that the stringkey we pass from Abacus might not exist in localization, since we aren't translating protocol errors 1:1. example. other than just translating all error codes and catching all possible query results (which is not sustainable), we should fallback to show some error message that is relevant
stringifyTransactionError
, because when a normal Error is thrown (e.g. query update failure), JSON.stringify will not workerrorStringKey?: string
toerrorParams?: ErrorParams
, the latter includes a potential error string key and a fallback error messagefallback
param, so when the string key isn't valid (part of STRING_KEYS), we should explicitly define fallback string. this is kinda optional so open to thoughts!before, query result failure (e.g. failure during subaccount transfer) will show no error strings. after: