add pybind version of HANDLE_TH_ERRORS
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26614
Test Plan: Imported from OSS
Differential Revision: D18249634
Pulled By: albanD
fbshipit-source-id: 25503f368926e0f3633c5af0f222c9bb4729f342