Do not swallow exception on NameError within constant.

Fixes https://github.com/rails/rails/issues/9933.