enhance assertErrorRegex to deal with OSErrors properly