[Refactoring] Remove duplication of nothrow check code