File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 7
7
require 'jsonapi_errors_handler/error_serializer'
8
8
9
9
module JsonapiErrorsHandler
10
+ PREDEFINED_HASH = {
11
+ 'JsonapiErrorsHandler::Errors::Invalid' =>
12
+ 'JsonapiErrorsHandler::Errors::Invalid' ,
13
+ 'JsonapiErrorsHandler::Errors::Forbidden' =>
14
+ 'JsonapiErrorsHandler::Errors::Forbidden' ,
15
+ 'JsonapiErrorsHandler::Errors::NotFound' => '
16
+ JsonapiErrorsHandler::Errors::NotFound' ,
17
+ 'JsonapiErrorsHandler::Errors::Unauthorized' =>
18
+ 'JsonapiErrorsHandler::Errors::Unauthorized'
19
+ } . freeze
20
+
10
21
def self . included ( base )
11
22
base . class_eval do
12
- ErrorMapper . map_errors! (
13
- 'JsonapiErrorsHandler::Errors::Invalid' => 'JsonapiErrorsHandler::Errors::Invalid' ,
14
- 'JsonapiErrorsHandler::Errors::Forbidden' => 'JsonapiErrorsHandler::Errors::Forbidden' ,
15
- 'JsonapiErrorsHandler::Errors::NotFound' => 'JsonapiErrorsHandler::Errors::NotFound' ,
16
- 'JsonapiErrorsHandler::Errors::Unauthorized' => 'JsonapiErrorsHandler::Errors::Unauthorized'
17
- )
23
+ ErrorMapper . map_errors! ( PREDEFINED_HASH )
18
24
end
19
25
end
20
26
You can’t perform that action at this time.
0 commit comments