kremalicious/blog

View on GitHub
src/features/Web3/hooks/useSend/isUnhelpfulErrorMessage.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
const terribleErrorMessages = [
  'User rejected the request',
  'User denied transaction signature',
  'Cannot read properties of undefined',
  'User cancelled the request'
]

export function isUnhelpfulErrorMessage(message: string) {
  return terribleErrorMessages.some((terribleMessage) =>
    message.includes(terribleMessage)
  )
}