Following code has been tested with Rails 2.3.5 .
Every one knows for sure that hoptoad notifier sends exception messages to server in production environment. Between ‘development’ and ‘production’ there could be a number of environments. Some of these would have settings closer to ‘development’ environment and some would have setting closely matching the settings of ‘production’ environment.
When you have many environments and when an exception occurs, one is not really sure if that message is getting logged at hoptoad or not. Here is a run down of which messages will get logged and why.
It alls starts with rails
When an exception occurs while rendering a page then
action_controller catches the exception. Following logic is evaluated to decide if user should see an error page with full stack trace or ‘we are sorry something went wrong’ message.
Let’s look at first part
consider_all_requests_local . Open
As you can see in development mode all requests are local. Be careful with what you put in your intermediary environments.
If you want to override that value then you can do like this.
The second part of the equation was
Rails has following code for that method.
As you can see all requests coming from
127.0.0.1 are considered local even if RAILS_ENV is ‘production’. For testing purpose you can override this value like this.
Hoptoad has access to exception now what
consider_all_request_local is false and if request is not local then hoptoad will get access to exception thanks to
rescue_action_in_public_with_hoptoad there is a call to
notify_or_ignore like this.
For majority of us there is no special handling for a particular
Hoptoad defines following methods as ignorable by default and you won’t get notifications for following types of exceptions.
Next hop is method
configuration.public? is defined like this.
As you can see if the
cucumber the exception will not be reported to hoptoad server.