Forum: Ruby on Rails What is hijacking exceptions?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
91d00b2e1d76029cb9175053a846051b?d=identicon&s=25 Michael Johnston (Guest)
on 2007-04-02 13:08
(Received via mailing list)
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:
    perform_action_without_rescue
    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
391f9b787cdc12aa2c179713f5103e3a?d=identicon&s=25 Ilan Berci (iberci)
on 2007-04-02 16:30
Michael Johnston wrote:

> 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?
>
>

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

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

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

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..

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?

hope this helps..

ilan
91d00b2e1d76029cb9175053a846051b?d=identicon&s=25 Michael Johnston (Guest)
on 2007-04-02 18:11
(Received via mailing list)
> First, I am assuming you are using the development configuration as
> rails handles failures differently  (and logs differently) in other
> configurations.

yes, of course

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

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..
>
> ilan
>

THanks,
Michael
91d00b2e1d76029cb9175053a846051b?d=identicon&s=25 Michael Johnston (Guest)
on 2007-04-03 17:13
(Received via mailing list)
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
This topic is locked and can not be replied to.