Do not swallow exception on NameError within constant.

Fixes https://github.com/rails/rails/issues/9933.
@tgxworld there should be a helper for that: `remove_constants`.