Use consistent exceptions in checkTypeRef.

1 job for 317930-fix-check-class-adapter-check-typeref-exceptions in 8 minutes and 32 seconds (queued for 4 seconds)