fix access of undefined property

This commit is contained in:
Moody Salem 2021-05-13 09:37:04 -05:00
parent 5c96942922
commit 3d95b1a33b
No known key found for this signature in database
GPG Key ID: 8CB5CD10385138DB

@ -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)