Sam Van Damme PRO said over 7 years ago on Custom Error Pages with Slack Notification :

Awesome, I could really use this.

Thanks!


Rocela Durazo said over 7 years ago on Custom Error Pages with Slack Notification :

Nice video, thank you :-)


yuki24 said over 7 years ago on Custom Error Pages with Slack Notification :

This pattern is extremely error-prone. There was once a section for implementing custom error pages in the official Rails guides that basically suggested the same approach as this episode, which was later removed because of potential issues it could introduce. In this episode specifically, there is a number of potential issues:

  • It doesn't filter or summarize exception details at all, so depending on how an exception is raised the app would end up brute forcing your slack channel with a lot of noisy events
  • self.routes only responds to 404 and 500 and can't handle any other HTTP statuses, which results in ActionController::RoutingError in the case of e.g. ActionController::MethodNotAllowed that is mapped to 405 (good luck on adding every single status to config/routes.rb)
  • If the SlackNotifyJob is configured to use an external queue (e.g. sidekiq, RabbitMQ) and an exception occurs due to that queue, it would raise an exception again and show an empty error page to the user (this is actually taken care of with a begin ... rescue ... end block, but still this is an issue that shouldn't exist)
  • The ErrorsController inherits from ApplicationController. This means that if the ApplicationController raises an exception in a before_action, the ErrorsController would raise the same exception again, which results in the same empty error page situation

A much better way would be to use a service like Sentry and configure it to send events to your slack channel.


biruktes said over 6 years ago on Custom Error Pages with Slack Notification :
Getting this, it is not matching 404 `ActionController::RoutingError: No route matches [GET] "/j"` Any ideas? Cheers

bertrand.signoret said about 6 years ago on Custom Error Pages with Slack Notification :
I get errors when trying to apply methods message and source_extract : ``` begin exception = request.env['action_dispatch.show_detailed_exceptions'] message = exception.message.to_s source_extract = exception.source_extract.join("\n") backtrace = exception.backtrace[0..9].join("\n") SlackNotifyWorker.perform_async(message, source_extract, backtrace) ensure render status: 500 ``` Error during failsafe response: undefined method `message' for false:FalseClass Error during failsafe response: undefined method `source_extract' for false:FalseClass Any ideas ?

David Kimura PRO said about 6 years ago on Custom Error Pages with Slack Notification :
It seems like `request.env['action_dispatch.show_detailed_exceptions']` is returning true or false instead of the actual messages.

bertrand.signoret said about 6 years ago on Custom Error Pages with Slack Notification :
I was simulating a 500 error. Wasn't I supposed to get more from exception ?

Login to Comment