mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 08:14:20 +00:00
#116 raise errors
This commit is contained in:
parent
7507f23ada
commit
15be1cac7e
@ -116,7 +116,7 @@ class CustomWorkflow < ActiveRecord::Base
|
|||||||
object.instance_eval(read_attribute(event)) if respond_to?(event) && read_attribute(event)
|
object.instance_eval(read_attribute(event)) if respond_to?(event) && read_attribute(event)
|
||||||
rescue WorkflowError => _
|
rescue WorkflowError => _
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
errors.add event, :invalid_script, :errors => e
|
errors.add event, :invalid_script, error: e
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_scripts_presence
|
def validate_scripts_presence
|
||||||
|
|||||||
@ -40,6 +40,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:attachment, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:attachment, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -54,6 +54,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:group, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:group, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -68,6 +68,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:issue, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:issue, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -59,6 +59,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:project, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:project, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -40,6 +40,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:time_entry, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:time_entry, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -40,6 +40,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:user, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:user, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -40,6 +40,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:version, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:version, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
@ -40,6 +40,7 @@ module RedmineCustomWorkflows
|
|||||||
@saved_attributes = attributes.dup
|
@saved_attributes = attributes.dup
|
||||||
CustomWorkflow.run_shared_code(self)
|
CustomWorkflow.run_shared_code(self)
|
||||||
CustomWorkflow.run_custom_workflows(:wiki_content, self, :before_save)
|
CustomWorkflow.run_custom_workflows(:wiki_content, self, :before_save)
|
||||||
|
throw :abort if errors.any?
|
||||||
errors.empty? && (@saved_attributes == attributes || valid?)
|
errors.empty? && (@saved_attributes == attributes || valid?)
|
||||||
ensure
|
ensure
|
||||||
@saved_attributes = nil
|
@saved_attributes = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user