fix access of undefined property
This commit is contained in:
parent
5c96942922
commit
3d95b1a33b
@ -142,7 +142,7 @@ export function swapErrorToUserReadableMessage(error: any): string {
|
|||||||
let reason: string | undefined
|
let reason: string | undefined
|
||||||
while (Boolean(error)) {
|
while (Boolean(error)) {
|
||||||
reason = error.reason ?? error.message ?? reason
|
reason = error.reason ?? error.message ?? reason
|
||||||
error = error.error ?? error.data.originalError
|
error = error.error ?? error.data?.originalError
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason?.indexOf('execution reverted: ') === 0) reason = reason.substr('execution reverted: '.length)
|
if (reason?.indexOf('execution reverted: ') === 0) reason = reason.substr('execution reverted: '.length)
|
||||||
|
Loading…
Reference in New Issue
Block a user