[FIX] check if error is a string before error.match