Module: Core::Service::Error::Behaviour

Included in:
ActiveRecord::ActiveRecordError, Aliquot::TagClash, Core::Service::Error, IllegalOperation
Defined in:
app/api/core/service.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/api/core/service.rb', line 9

def self.included(base)
  base.class_eval do
    class_attribute :api_error_code
    class_attribute :api_error_message
    alias_method :api_error_message, :message
    self.api_error_code = 500
  end
end

Instance Method Details

#api_error(response) ⇒ Object



18
19
20
# File 'app/api/core/service.rb', line 18

def api_error(response)
  response.general_error(self.class.api_error_code, [self.class.api_error_message || api_error_message])
end