Do not swallow exception on NameError within constant.

Fixes https://github.com/rails/rails/issues/9933.
@matthewd Found the leaking test :smile: