@@ -16,7 +16,8 @@ class Configuration
1616 :use_text_errors ,
1717 :top_level_links_include_pagination ,
1818 :top_level_meta_include_record_count ,
19- :top_level_meta_record_count_key
19+ :top_level_meta_record_count_key ,
20+ :exception_class_whitelist
2021
2122 def initialize
2223 #:underscored_key, :camelized_key, :dasherized_key, or custom
@@ -45,6 +46,14 @@ def initialize
4546 self . top_level_meta_record_count_key = :record_count
4647
4748 self . use_text_errors = false
49+
50+ # List of classes that should not be rescued by the operations processor.
51+ # For example, if you use Pundit for authorization, you might
52+ # raise a Pundit::NotAuthorizedError at some point during operations
53+ # processing. If you want to use Rails' `rescue_from` macro to
54+ # catch this error and render a 403 status code, you should add
55+ # the `Pundit::NotAuthorizedError` to the `exception_class_whitelist`.
56+ self . exception_class_whitelist = [ ]
4857 end
4958
5059 def json_key_format = ( format )
@@ -77,6 +86,8 @@ def operations_processor=(operations_processor)
7786 attr_writer :top_level_meta_include_record_count
7887
7988 attr_writer :top_level_meta_record_count_key
89+
90+ attr_writer :exception_class_whitelist
8091 end
8192
8293 class << self
0 commit comments