What is hijacking exceptions?

I really would appreciate someone who can help me this.

Even if I wrap my whole view in a begin rescue block, I am still having it fail silently with no exception logging & no output when there is an error in code called in the view.

The farthest I've got is to discover than in rescue.rb, exceptions never trickle back up to the rescue in perform_action_with_rescue:

in rescue.rb,

  def perform_action_with_rescue #:nodoc:
    RAILS_DEFAULT_LOGGER.debug("rescue.rb - A: ")
  rescue Exception => exception # errors from action performed
    RAILS_DEFAULT_LOGGER.debug("rescue.rb - B: ")

when the code called by the template has an exception, execution never returns to either point A or point B

There's about a dozen or more levels of filters, caching, benchmarking etc. after that point that I haven't traced through yet. Does anyone have any idea what/why could be swallowing exceptions?

Michael Johnston

First, I am assuming you are using the development configuration as
rails handles failures differently (and logs differently) in other

yes, of course

Secondly, if you never see the exception. How do you know one is being

sometimes if I wrap the template in a begin/rescue, I can see the exceptions. But sometimes they are lost when I do that too.
Anyway, if there was no exception, it would serve the view. What I'm talking about is when I'm developing, and I write some code. If the code has an error in it, all I get is "network lost connection" from the browser, and nothing in the log.

Third, if you are sure that an exception is raised. Does the
RAILS_DEFAULT_LOGGER exist or did you change it in your configuration

RAILS_DEFAULT_LOGGER is fine. That's how I currently resort to finding where my error is, by sticking in log statements until one doesn't get printed

Fourth, if the logger is logging, is the logger set to a higher priority
than debug? If you are in a different development environment, the
logger may have a higher priority than debug such as: error in which
case you won't see the errors above..

No, the problem has nothing to do with that. I use logger.debug all the time.

Lastly, If it does exist, does it have permission to write to the file
that it's writing to under the account that rails is running under?

The development log is ok. Normal logging works fine. This is a case of something capturing and not passing along exceptions to where they should bubble.

It's probably a bug in some plugin that I installed that adds some filter to the dispatch chain that has a rescue in it that doesn't re-throw, and I'm going to have to wade through the layers of dispatch code after "perform_action_with_rescue" to find it. I was just hoping someone might know off the top of their head, because the dispatch code is somewhat abstracted and tough to trace through.

hope this helps..



Ok, I figured out that it is Globalize.

I don't understand yet after a first look at the code how it is
killing the exception handling, but if I comment out the contents of
the Globalize plugin's ActionView extensions, exceptions get reported
in the production.log (although still not to the browser, haven't
figured that part out yet)

I don't really understand by looking at the globalize code how it is
preventing exceptions from bubbling back, though.

Michael Johnston