@@ -24,6 +24,7 @@ class Configuration
2424 :allow_transactions ,
2525 :include_backtraces_in_errors ,
2626 :exception_class_whitelist ,
27+ :whitelist_all_exceptions ,
2728 :always_include_to_one_linkage_data ,
2829 :always_include_to_many_linkage_data ,
2930 :cache_formatters ,
@@ -81,6 +82,11 @@ def initialize
8182 # the `Pundit::NotAuthorizedError` to the `exception_class_whitelist`.
8283 self . exception_class_whitelist = [ ]
8384
85+
86+ # If enabled, will override configuration option `exception_class_whitelist`
87+ # and whitelist all exceptions.
88+ self . whitelist_all_exceptions = false
89+
8490 # Resource Linkage
8591 # Controls the serialization of resource linkage for non compound documents
8692 # NOTE: always_include_to_many_linkage_data is not currently implemented
@@ -188,7 +194,8 @@ def route_formatter
188194 end
189195
190196 def exception_class_whitelisted? ( e )
191- @exception_class_whitelist . flatten . any? { |k | e . class . ancestors . map ( &:to_s ) . include? ( k . to_s ) }
197+ @whitelist_all_exceptions ||
198+ @exception_class_whitelist . flatten . any? { |k | e . class . ancestors . map ( &:to_s ) . include? ( k . to_s ) }
192199 end
193200
194201 def default_processor_klass = ( default_processor_klass )
@@ -221,6 +228,8 @@ def default_processor_klass=(default_processor_klass)
221228
222229 attr_writer :exception_class_whitelist
223230
231+ attr_writer :whitelist_all_exceptions
232+
224233 attr_writer :always_include_to_one_linkage_data
225234
226235 attr_writer :always_include_to_many_linkage_data
0 commit comments