Newbie here. What is the best practice for implementing error
reporting in a Rails application. I have an example that uses
ActiveRecord::Base.logger.error. Are there any risks with this or
recommendations on other implementations?
Thanks
Newbie here. What is the best practice for implementing error
reporting in a Rails application. I have an example that uses
ActiveRecord::Base.logger.error. Are there any risks with this or
recommendations on other implementations?
Thanks
On Sep 18, 6:50pm, jthaddeus [email protected] wrote:
Newbie here. What is the best practice for implementing error
reporting in a Rails application. I have an example that uses
ActiveRecord::Base.logger.error. Are there any risks with this or
recommendations on other implementations?
There’s nothing wrong with just logging errors, but in less you are
really extremely diligent about monitoring your log files for errors,
you’re not going to notice problems until a user tells you or they
snowball into bigger errors. Some 3rd party solutions include
exceptional (www.getexceptional.com/) or airbrake
(www.airbrakeapp.com) or the exception notifier plugin (https://
github.com/smartinez87/exception_notification). You can also roll your
own by overwriting the rescue_action_in_public method
Fred
Thanks much for the response and the 3rd party solution link.
The more in detailed questions I have around best practices for error
handling are:
Thanks for all your help
On Sep 19, 7:15pm, jthaddeus [email protected] wrote:
Thanks much for the response and the 3rd party solution link.
The more in detailed questions I have around best practices for error
handling are:
- Where are error the message generated? In the example we have they
are generated in the Model. Is this best practice- How are error messages displayed to the end user as friendly
messages?
Presenting errors to users is a whole different kettle of fish. The
default rescue_action_in_public method just renders your 500.html
page. You probably want to at least replace that with something more
cuddly than the default. You might want to provide a little more
information, but do bear in mind that most information about an
exception or error are irrelevant to users. If there is something they
can do to fix it or if it is a transient thing that will fix itself in
a minute then that is useful info to them. Extra details tend to be
overkill (assuming you are collecting all the error data so that you
can fix things or respond appropriately when someone asks you why
stuff doesn’t work.
I would usually have the model let the controller know via exceptions/
return values when something has gone wrong and let the controller
decide how to present that to the user (of course sometimes the
controller will defer to the model for that, eg validation errors).
Fred
exceptional (www.getexceptional.com/) or airbrake
(www.airbrakeapp.com) or the exception notifier plugin (https://
github.com/smartinez87/exception_notification). You can also roll your
own by overwriting the rescue_action_in_public method
You can also use airbrake’s gem with your own web UI via
https://github.com/errbit/errbit
-philip
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs