@@ -24,6 +24,7 @@ class Configuration
24
24
:allow_transactions ,
25
25
:include_backtraces_in_errors ,
26
26
:exception_class_whitelist ,
27
+ :whitelist_all_exceptions ,
27
28
:always_include_to_one_linkage_data ,
28
29
:always_include_to_many_linkage_data ,
29
30
:cache_formatters ,
@@ -81,6 +82,11 @@ def initialize
81
82
# the `Pundit::NotAuthorizedError` to the `exception_class_whitelist`.
82
83
self . exception_class_whitelist = [ ]
83
84
85
+
86
+ # If enabled, will override configuration option `exception_class_whitelist`
87
+ # and whitelist all exceptions.
88
+ self . whitelist_all_exceptions = false
89
+
84
90
# Resource Linkage
85
91
# Controls the serialization of resource linkage for non compound documents
86
92
# NOTE: always_include_to_many_linkage_data is not currently implemented
@@ -188,7 +194,8 @@ def route_formatter
188
194
end
189
195
190
196
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 ) }
192
199
end
193
200
194
201
def default_processor_klass = ( default_processor_klass )
@@ -221,6 +228,8 @@ def default_processor_klass=(default_processor_klass)
221
228
222
229
attr_writer :exception_class_whitelist
223
230
231
+ attr_writer :whitelist_all_exceptions
232
+
224
233
attr_writer :always_include_to_one_linkage_data
225
234
226
235
attr_writer :always_include_to_many_linkage_data
0 commit comments