module KintoneNotifier::InstanceMethods
Protected Instance Methods
compose_exception_description(exception)
click to toggle source
# File lib/kintone_notifier.rb, line 80 def compose_exception_description(exception) [].tap do |vars| vars << "======================================" vars << "Base Message" vars << "======================================" vars << exception.message vars << "" vars << "" vars << "======================================" vars << "BackTrace" vars << "======================================" vars << exception.backtrace end.join("\r\n") end
compose_exception_title(exception)
click to toggle source
# File lib/kintone_notifier.rb, line 72 def compose_exception_title(exception) str = "" str << "#{self.controller_name}##{self.action_name}" str << " (#{exception.class})" str << " #{exception.message.inspect}" str.length > 120 ? str[0...120] + "..." : str end
render_404()
click to toggle source
# File lib/kintone_notifier.rb, line 41 def render_404 render :template => 'errors/404', :layout => false, :status => 404 end
render_500(exception=nil)
click to toggle source
# File lib/kintone_notifier.rb, line 45 def render_500(exception=nil) # render :file => "#{Rails.root}/public/500.html", :status => 500, :layout => false, :content_type => 'text/html' if exception.present? bot = KintoneNotifier::Bot.new notice = { "title" => compose_exception_title(exception), "url" => request.url, "http_method" => request.request_method, "remote_ip" => request.remote_ip, "parameters" => request.filtered_parameters.inspect, "exception_class_name" => exception.class.name, "description" => exception.message, "backtrace" => exception.backtrace.join("\r\n"), "session" => session.inspect, "environment" => request_env_string, "user_agent" => request.headers["HTTP_USER_AGENT"] } bot.tweet(notice) end render :file => 'errors/500', :layout => false, :status => 500 end
request_env_string()
click to toggle source
# File lib/kintone_notifier.rb, line 68 def request_env_string request.env.map{|k,v|"#{k}:#{v}"}.join("\r\n") end