[JIT] Improve the error message when registering a custom class twice (#35568)
Summary:
I hit this exception when including the registration code with `torch::class_` in a header file, which was included in multiple cpp files and thus called this twice. It could be helpful to improve the error msg here to indicate what exactly happened.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35568
Differential Revision: D20759476
Pulled By: rohan-varma
fbshipit-source-id: 680f6a8abb4453cd7a311cda1e2a03f81e7f7442