Use subclass of TypeError instead of non-class method for clearer type errors.