Maintenance: CoreWorkflow throws more verbose exception
This commit is contained in:
parent
1af052015f
commit
90d03cf542
2 changed files with 11 additions and 2 deletions
|
@ -34,7 +34,7 @@ module ChecksCoreWorkflow
|
||||||
next if self[key].blank?
|
next if self[key].blank?
|
||||||
next if restricted_value?(perform_result, key)
|
next if restricted_value?(perform_result, key)
|
||||||
|
|
||||||
raise Exceptions::UnprocessableEntity, "Invalid value '#{self[key]}' for field '#{key}'!"
|
raise Exceptions::ApplicationModel.new(self, "Invalid value '#{self[key]}' for field '#{key}'!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ module ChecksCoreWorkflow
|
||||||
next if !column_value?(key)
|
next if !column_value?(key)
|
||||||
next if !colum_default?(key)
|
next if !colum_default?(key)
|
||||||
|
|
||||||
raise Exceptions::UnprocessableEntity, "Missing required value for field '#{key}'!"
|
raise Exceptions::ApplicationModel.new(self, "Missing required value for field '#{key}'!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,15 @@ module Exceptions
|
||||||
|
|
||||||
class UnprocessableEntity < StandardError; end
|
class UnprocessableEntity < StandardError; end
|
||||||
|
|
||||||
|
class ApplicationModel < UnprocessableEntity
|
||||||
|
attr_reader :record
|
||||||
|
|
||||||
|
def initialize(record, message)
|
||||||
|
super(message)
|
||||||
|
@record = record
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.policy_class
|
def self.policy_class
|
||||||
ExceptionsPolicy
|
ExceptionsPolicy
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue