Guest User

Untitled

a guest
Jul 31st, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.54 KB | None | 0 0
  1. Index: vendor/plugins/exception_notification/test/test_helper.rb
  2. ===================================================================
  3. --- vendor/plugins/exception_notification/test/test_helper.rb (revision 2)
  4. +++ vendor/plugins/exception_notification/test/test_helper.rb (working copy)
  5. @@ -1,7 +0,0 @@
  6. -require 'test/unit'
  7. -require 'rubygems'
  8. -require 'active_support'
  9. -
  10. -$:.unshift File.join(File.dirname(__FILE__), '../lib')
  11. -
  12. -RAILS_ROOT = '.' unless defined?(RAILS_ROOT)
  13. Index: vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb
  14. ===================================================================
  15. --- vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb (revision 2)
  16. +++ vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb (working copy)
  17. @@ -1,61 +0,0 @@
  18. -require 'test_helper'
  19. -require 'exception_notifier_helper'
  20. -
  21. -class ExceptionNotifierHelperTest < Test::Unit::TestCase
  22. -
  23. - class ExceptionNotifierHelperIncludeTarget
  24. - include ExceptionNotifierHelper
  25. - end
  26. -
  27. - def setup
  28. - @helper = ExceptionNotifierHelperIncludeTarget.new
  29. - end
  30. -
  31. - # No controller
  32. -
  33. - def test_should_not_exclude_raw_post_parameters_if_no_controller
  34. - assert !@helper.exclude_raw_post_parameters?
  35. - end
  36. -
  37. - # Controller, no filtering
  38. -
  39. - class ControllerWithoutFilterParameters; end
  40. -
  41. - def test_should_not_filter_env_values_for_raw_post_data_keys_if_controller_can_not_filter_parameters
  42. - stub_controller(ControllerWithoutFilterParameters.new)
  43. - assert @helper.filter_sensitive_post_data_from_env("RAW_POST_DATA", "secret").include?("secret")
  44. - end
  45. - def test_should_not_exclude_raw_post_parameters_if_controller_can_not_filter_parameters
  46. - stub_controller(ControllerWithoutFilterParameters.new)
  47. - assert !@helper.exclude_raw_post_parameters?
  48. - end
  49. - def test_should_return_params_if_controller_can_not_filter_parameters
  50. - stub_controller(ControllerWithoutFilterParameters.new)
  51. - assert_equal :params, @helper.filter_sensitive_post_data_parameters(:params)
  52. - end
  53. -
  54. - # Controller with filtering
  55. -
  56. - class ControllerWithFilterParameters
  57. - def filter_parameters(params); :filtered end
  58. - end
  59. -
  60. - def test_should_filter_env_values_for_raw_post_data_keys_if_controller_can_filter_parameters
  61. - stub_controller(ControllerWithFilterParameters.new)
  62. - assert !@helper.filter_sensitive_post_data_from_env("RAW_POST_DATA", "secret").include?("secret")
  63. - assert @helper.filter_sensitive_post_data_from_env("SOME_OTHER_KEY", "secret").include?("secret")
  64. - end
  65. - def test_should_exclude_raw_post_parameters_if_controller_can_filter_parameters
  66. - stub_controller(ControllerWithFilterParameters.new)
  67. - assert @helper.exclude_raw_post_parameters?
  68. - end
  69. - def test_should_delegate_param_filtering_to_controller_if_controller_can_filter_parameters
  70. - stub_controller(ControllerWithFilterParameters.new)
  71. - assert_equal :filtered, @helper.filter_sensitive_post_data_parameters(:params)
  72. - end
  73. -
  74. - private
  75. - def stub_controller(controller)
  76. - @helper.instance_variable_set(:@controller, controller)
  77. - end
  78. -end
  79. \ No newline at end of file
  80. Index: vendor/plugins/exception_notification/init.rb
  81. ===================================================================
  82. --- vendor/plugins/exception_notification/init.rb (revision 2)
  83. +++ vendor/plugins/exception_notification/init.rb (working copy)
  84. @@ -1 +0,0 @@
  85. -require "action_mailer"
  86. Index: vendor/plugins/exception_notification/lib/exception_notifier.rb
  87. ===================================================================
  88. --- vendor/plugins/exception_notification/lib/exception_notifier.rb (revision 2)
  89. +++ vendor/plugins/exception_notification/lib/exception_notifier.rb (working copy)
  90. @@ -1,66 +0,0 @@
  91. -require 'pathname'
  92. -
  93. -# Copyright (c) 2005 Jamis Buck
  94. -#
  95. -# Permission is hereby granted, free of charge, to any person obtaining
  96. -# a copy of this software and associated documentation files (the
  97. -# "Software"), to deal in the Software without restriction, including
  98. -# without limitation the rights to use, copy, modify, merge, publish,
  99. -# distribute, sublicense, and/or sell copies of the Software, and to
  100. -# permit persons to whom the Software is furnished to do so, subject to
  101. -# the following conditions:
  102. -#
  103. -# The above copyright notice and this permission notice shall be
  104. -# included in all copies or substantial portions of the Software.
  105. -#
  106. -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  107. -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  108. -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  109. -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  110. -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  111. -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  112. -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  113. -class ExceptionNotifier < ActionMailer::Base
  114. - @@sender_address = %("Exception Notifier" <exception.notifier@default.com>)
  115. - cattr_accessor :sender_address
  116. -
  117. - @@exception_recipients = []
  118. - cattr_accessor :exception_recipients
  119. -
  120. - @@email_prefix = "[ERROR] "
  121. - cattr_accessor :email_prefix
  122. -
  123. - @@sections = %w(request session environment backtrace)
  124. - cattr_accessor :sections
  125. -
  126. - self.template_root = "#{File.dirname(__FILE__)}/../views"
  127. -
  128. - def self.reloadable?() false end
  129. -
  130. - def exception_notification(exception, controller, request, data={})
  131. - content_type "text/plain"
  132. -
  133. - subject "#{email_prefix}#{controller.controller_name}##{controller.action_name} (#{exception.class}) #{exception.message.inspect}"
  134. -
  135. - recipients exception_recipients
  136. - from sender_address
  137. -
  138. - body data.merge({ :controller => controller, :request => request,
  139. - :exception => exception, :host => (request.env["HTTP_X_FORWARDED_HOST"] || request.env["HTTP_HOST"]),
  140. - :backtrace => sanitize_backtrace(exception.backtrace),
  141. - :rails_root => rails_root, :data => data,
  142. - :sections => sections })
  143. - end
  144. -
  145. - private
  146. -
  147. - def sanitize_backtrace(trace)
  148. - re = Regexp.new(/^#{Regexp.escape(rails_root)}/)
  149. - trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s }
  150. - end
  151. -
  152. - def rails_root
  153. - @rails_root ||= Pathname.new(RAILS_ROOT).cleanpath.to_s
  154. - end
  155. -
  156. -end
  157. Index: vendor/plugins/exception_notification/lib/exception_notifiable.rb
  158. ===================================================================
  159. --- vendor/plugins/exception_notification/lib/exception_notifiable.rb (revision 2)
  160. +++ vendor/plugins/exception_notification/lib/exception_notifiable.rb (working copy)
  161. @@ -1,99 +0,0 @@
  162. -require 'ipaddr'
  163. -
  164. -# Copyright (c) 2005 Jamis Buck
  165. -#
  166. -# Permission is hereby granted, free of charge, to any person obtaining
  167. -# a copy of this software and associated documentation files (the
  168. -# "Software"), to deal in the Software without restriction, including
  169. -# without limitation the rights to use, copy, modify, merge, publish,
  170. -# distribute, sublicense, and/or sell copies of the Software, and to
  171. -# permit persons to whom the Software is furnished to do so, subject to
  172. -# the following conditions:
  173. -#
  174. -# The above copyright notice and this permission notice shall be
  175. -# included in all copies or substantial portions of the Software.
  176. -#
  177. -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  178. -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  179. -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  180. -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  181. -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  182. -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  183. -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  184. -module ExceptionNotifiable
  185. - def self.included(target)
  186. - target.extend(ClassMethods)
  187. - end
  188. -
  189. - module ClassMethods
  190. - def consider_local(*args)
  191. - local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })
  192. - end
  193. -
  194. - def local_addresses
  195. - addresses = read_inheritable_attribute(:local_addresses)
  196. - unless addresses
  197. - addresses = [IPAddr.new("127.0.0.1")]
  198. - write_inheritable_attribute(:local_addresses, addresses)
  199. - end
  200. - addresses
  201. - end
  202. -
  203. - def exception_data(deliverer=self)
  204. - if deliverer == self
  205. - read_inheritable_attribute(:exception_data)
  206. - else
  207. - write_inheritable_attribute(:exception_data, deliverer)
  208. - end
  209. - end
  210. -
  211. - def exceptions_to_treat_as_404
  212. - exceptions = [ActiveRecord::RecordNotFound,
  213. - ActionController::UnknownController,
  214. - ActionController::UnknownAction]
  215. - exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
  216. - exceptions
  217. - end
  218. - end
  219. -
  220. - private
  221. -
  222. - def local_request?
  223. - remote = IPAddr.new(request.remote_ip)
  224. - !self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?
  225. - end
  226. -
  227. - def render_404
  228. - respond_to do |type|
  229. - type.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" }
  230. - type.all { render :nothing => true, :status => "404 Not Found" }
  231. - end
  232. - end
  233. -
  234. - def render_500
  235. - respond_to do |type|
  236. - type.html { render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error" }
  237. - type.all { render :nothing => true, :status => "500 Error" }
  238. - end
  239. - end
  240. -
  241. - def rescue_action_in_public(exception)
  242. - case exception
  243. - when *self.class.exceptions_to_treat_as_404
  244. - render_404
  245. -
  246. - else
  247. - render_500
  248. -
  249. - deliverer = self.class.exception_data
  250. - data = case deliverer
  251. - when nil then {}
  252. - when Symbol then send(deliverer)
  253. - when Proc then deliverer.call(self)
  254. - end
  255. -
  256. - ExceptionNotifier.deliver_exception_notification(exception, self,
  257. - request, data)
  258. - end
  259. - end
  260. -end
  261. Index: vendor/plugins/exception_notification/lib/exception_notifier_helper.rb
  262. ===================================================================
  263. --- vendor/plugins/exception_notification/lib/exception_notifier_helper.rb (revision 2)
  264. +++ vendor/plugins/exception_notification/lib/exception_notifier_helper.rb (working copy)
  265. @@ -1,78 +0,0 @@
  266. -require 'pp'
  267. -
  268. -# Copyright (c) 2005 Jamis Buck
  269. -#
  270. -# Permission is hereby granted, free of charge, to any person obtaining
  271. -# a copy of this software and associated documentation files (the
  272. -# "Software"), to deal in the Software without restriction, including
  273. -# without limitation the rights to use, copy, modify, merge, publish,
  274. -# distribute, sublicense, and/or sell copies of the Software, and to
  275. -# permit persons to whom the Software is furnished to do so, subject to
  276. -# the following conditions:
  277. -#
  278. -# The above copyright notice and this permission notice shall be
  279. -# included in all copies or substantial portions of the Software.
  280. -#
  281. -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  282. -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  283. -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  284. -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  285. -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  286. -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  287. -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  288. -module ExceptionNotifierHelper
  289. - VIEW_PATH = "views/exception_notifier"
  290. - APP_PATH = "#{RAILS_ROOT}/app/#{VIEW_PATH}"
  291. - PARAM_FILTER_REPLACEMENT = "[FILTERED]"
  292. -
  293. - def render_section(section)
  294. - RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}")
  295. - summary = render_overridable(section).strip
  296. - unless summary.blank?
  297. - title = render_overridable(:title, :locals => { :title => section }).strip
  298. - "#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
  299. - end
  300. - end
  301. -
  302. - def render_overridable(partial, options={})
  303. - if File.exist?(path = "#{APP_PATH}/_#{partial}.rhtml")
  304. - render(options.merge(:file => path, :use_full_path => false))
  305. - elsif File.exist?(path = "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.rhtml")
  306. - render(options.merge(:file => path, :use_full_path => false))
  307. - else
  308. - ""
  309. - end
  310. - end
  311. -
  312. - def inspect_model_object(model, locals={})
  313. - render_overridable(:inspect_model,
  314. - :locals => { :inspect_model => model,
  315. - :show_instance_variables => true,
  316. - :show_attributes => true }.merge(locals))
  317. - end
  318. -
  319. - def inspect_value(value)
  320. - len = 512
  321. - result = object_to_yaml(value).gsub(/\n/, "\n ").strip
  322. - result = result[0,len] + "... (#{result.length-len} bytes more)" if result.length > len+20
  323. - result
  324. - end
  325. -
  326. - def object_to_yaml(object)
  327. - object.to_yaml.sub(/^---\s*/m, "")
  328. - end
  329. -
  330. - def exclude_raw_post_parameters?
  331. - @controller && @controller.respond_to?(:filter_parameters)
  332. - end
  333. -
  334. - def filter_sensitive_post_data_parameters(parameters)
  335. - exclude_raw_post_parameters? ? @controller.filter_parameters(parameters) : parameters
  336. - end
  337. -
  338. - def filter_sensitive_post_data_from_env(env_key, env_value)
  339. - return env_value unless exclude_raw_post_parameters?
  340. - return PARAM_FILTER_REPLACEMENT if (env_key =~ /RAW_POST_DATA/i)
  341. - return @controller.filter_parameters({env_key => env_value}).values[0]
  342. - end
  343. -end
  344. Index: vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml
  345. ===================================================================
  346. --- vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml (revision 2)
  347. +++ vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml (working copy)
  348. @@ -1 +0,0 @@
  349. -<%= @backtrace.join "\n" %>
  350. Index: vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml
  351. ===================================================================
  352. --- vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml (revision 2)
  353. +++ vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml (working copy)
  354. @@ -1,3 +0,0 @@
  355. --------------------------------
  356. -<%= title.to_s.humanize %>:
  357. --------------------------------
  358. Index: vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml
  359. ===================================================================
  360. --- vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml (revision 2)
  361. +++ vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml (working copy)
  362. @@ -1,2 +0,0 @@
  363. -* session id: <%= @request.session.instance_variable_get(:@session_id).inspect %>
  364. -* data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %>
  365. Index: vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml
  366. ===================================================================
  367. --- vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml (revision 2)
  368. +++ vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml (working copy)
  369. @@ -1,7 +0,0 @@
  370. -<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%>
  371. -<% @request.env.keys.sort.each do |key| -%>
  372. -* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
  373. -<% end -%>
  374. -
  375. -* Process: <%= $$ %>
  376. -* Server : <%= `hostname -s`.chomp %>
  377. Index: vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml
  378. ===================================================================
  379. --- vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml (revision 2)
  380. +++ vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml (working copy)
  381. @@ -1,16 +0,0 @@
  382. -<% if show_attributes -%>
  383. -[attributes]
  384. -<% attrs = inspect_model.attributes -%>
  385. -<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%>
  386. -<% attrs.keys.sort.each do |attr| -%>
  387. -* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ").strip] %>
  388. -<% end -%>
  389. -<% end -%>
  390. -
  391. -<% if show_instance_variables -%>
  392. -[instance variables]
  393. -<% inspect_model.instance_variables.sort.each do |variable| -%>
  394. -<%- next if variable == "@attributes" -%>
  395. -* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %>
  396. -<% end -%>
  397. -<% end -%>
  398. Index: vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml
  399. ===================================================================
  400. --- vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml (revision 2)
  401. +++ vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml (working copy)
  402. @@ -1,6 +0,0 @@
  403. -A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>:
  404. -
  405. - <%= @exception.message %>
  406. - <%= @backtrace.first %>
  407. -
  408. -<%= @sections.map { |section| render_section(section) }.join %>
  409. Index: vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml
  410. ===================================================================
  411. --- vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml (revision 2)
  412. +++ vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml (working copy)
  413. @@ -1,4 +0,0 @@
  414. -* URL : <%= @request.protocol %><%= @host %><%= @request.request_uri %>
  415. -* IP address: <%= @request.env["HTTP_X_FORWARDED_FOR"] || @request.env["REMOTE_ADDR"] %>
  416. -* Parameters: <%= filter_sensitive_post_data_parameters(@request.parameters).inspect %>
  417. -* Rails root: <%= @rails_root %>
  418. Index: vendor/plugins/exception_notification/README
  419. ===================================================================
  420. --- vendor/plugins/exception_notification/README (revision 2)
  421. +++ vendor/plugins/exception_notification/README (working copy)
  422. @@ -1,111 +0,0 @@
  423. -= Exception Notifier Plugin for Rails
  424. -
  425. -The Exception Notifier plugin provides a mailer object and a default set of
  426. -templates for sending email notifications when errors occur in a Rails
  427. -application. The plugin is configurable, allowing programmers to specify:
  428. -
  429. -* the sender address of the email
  430. -* the recipient addresses
  431. -* the text used to prefix the subject line
  432. -
  433. -The email includes information about the current request, session, and
  434. -environment, and also gives a backtrace of the exception.
  435. -
  436. -== Usage
  437. -
  438. -First, include the ExceptionNotifiable mixin in whichever controller you want
  439. -to generate error emails (typically ApplicationController):
  440. -
  441. - class ApplicationController < ActionController::Base
  442. - include ExceptionNotifiable
  443. - ...
  444. - end
  445. -
  446. -Then, specify the email recipients in your environment:
  447. -
  448. - ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)
  449. -
  450. -And that's it! The defaults take care of the rest.
  451. -
  452. -== Configuration
  453. -
  454. -You can tweak other values to your liking, as well. In your environment file,
  455. -just set any or all of the following values:
  456. -
  457. - # defaults to exception.notifier@default.com
  458. - ExceptionNotifier.sender_address =
  459. - %("Application Error" <app.error@myapp.com>)
  460. -
  461. - # defaults to "[ERROR] "
  462. - ExceptionNotifier.email_prefix = "[APP] "
  463. -
  464. -Email notifications will only occur when the IP address is determined not to
  465. -be local. You can specify certain addresses to always be local so that you'll
  466. -get a detailed error instead of the generic error page. You do this in your
  467. -controller (or even per-controller):
  468. -
  469. - consider_local "64.72.18.143", "14.17.21.25"
  470. -
  471. -You can specify subnet masks as well, so that all matching addresses are
  472. -considered local:
  473. -
  474. - consider_local "64.72.18.143/24"
  475. -
  476. -The address "127.0.0.1" is always considered local. If you want to completely
  477. -reset the list of all addresses (for instance, if you wanted "127.0.0.1" to
  478. -NOT be considered local), you can simply do, somewhere in your controller:
  479. -
  480. - local_addresses.clear
  481. -
  482. -== Customization
  483. -
  484. -By default, the notification email includes four parts: request, session,
  485. -environment, and backtrace (in that order). You can customize how each of those
  486. -sections are rendered by placing a partial named for that part in your
  487. -app/views/exception_notifier directory (e.g., _session.rhtml). Each partial has
  488. -access to the following variables:
  489. -
  490. -* @controller: the controller that caused the error
  491. -* @request: the current request object
  492. -* @exception: the exception that was raised
  493. -* @host: the name of the host that made the request
  494. -* @backtrace: a sanitized version of the exception's backtrace
  495. -* @rails_root: a sanitized version of RAILS_ROOT
  496. -* @data: a hash of optional data values that were passed to the notifier
  497. -* @sections: the array of sections to include in the email
  498. -
  499. -You can reorder the sections, or exclude sections completely, by altering the
  500. -ExceptionNotifier.sections variable. You can even add new sections that
  501. -describe application-specific data--just add the section's name to the list
  502. -(whereever you'd like), and define the corresponding partial. Then, if your
  503. -new section requires information that isn't available by default, make sure
  504. -it is made available to the email using the exception_data macro:
  505. -
  506. - class ApplicationController < ActionController::Base
  507. - ...
  508. - protected
  509. - exception_data :additional_data
  510. -
  511. - def additional_data
  512. - { :document => @document,
  513. - :person => @person }
  514. - end
  515. - ...
  516. - end
  517. -
  518. -In the above case, @document and @person would be made available to the email
  519. -renderer, allowing your new section(s) to access and display them. See the
  520. -existing sections defined by the plugin for examples of how to write your own.
  521. -
  522. -== Advanced Customization
  523. -
  524. -By default, the email notifier will only notify on critical errors. For
  525. -ActiveRecord::RecordNotFound and ActionController::UnknownAction, it will
  526. -simply render the contents of your public/404.html file. Other exceptions
  527. -will render public/500.html and will send the email notification. If you want
  528. -to use different rules for the notification, you will need to implement your
  529. -own rescue_action_in_public method. You can look at the default implementation
  530. -in ExceptionNotifiable for an example of how to go about that.
  531. -
  532. -
  533. -Copyright (c) 2005 Jamis Buck, released under the MIT license
  534. \ No newline at end of file
Add Comment
Please, Sign In to add comment