/regex/.test(e.message)
That doesn't break if message is undefined.