Cleanup rref_impl (#39530)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39530
Some cleanups for consistency and code reuse. Uses torch_check instead
of explicitly throwing runtime error. Calls RRefContext::handleError() for
default error handler fallback.
ghstack-source-id: 105424164
Test Plan: CI
Differential Revision: D21881244
fbshipit-source-id: c706244869e5ddb915f9d8e4f81d1365b4b57321