@@ -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,10 @@ def initialize
8182 # the `Pundit::NotAuthorizedError` to the `exception_class_whitelist`.
8283 self . exception_class_whitelist = [ ]
8384
85+ # If enabled, will override configuration option `exception_class_whitelist`
86+ # and whitelist all exceptions.
87+ self . whitelist_all_exceptions = false
88+
8489 # Resource Linkage
8590 # Controls the serialization of resource linkage for non compound documents
8691 # NOTE: always_include_to_many_linkage_data is not currently implemented
@@ -188,7 +193,8 @@ def route_formatter
188193 end
189194
190195 def exception_class_whitelisted? ( e )
191- @exception_class_whitelist . flatten . any? { |k | e . class . ancestors . map ( &:to_s ) . include? ( k . to_s ) }
196+ @whitelist_all_exceptions ||
197+ @exception_class_whitelist . flatten . any? { |k | e . class . ancestors . map ( &:to_s ) . include? ( k . to_s ) }
192198 end
193199
194200 def default_processor_klass = ( default_processor_klass )
@@ -221,6 +227,8 @@ def default_processor_klass=(default_processor_klass)
221227
222228 attr_writer :exception_class_whitelist
223229
230+ attr_writer :whitelist_all_exceptions
231+
224232 attr_writer :always_include_to_one_linkage_data
225233
226234 attr_writer :always_include_to_many_linkage_data
0 commit comments