Class: Collavre::Comments::ActionExecutor
- Inherits:
-
Object
- Object
- Collavre::Comments::ActionExecutor
- Defined in:
- app/services/collavre/comments/action_executor.rb
Defined Under Namespace
Classes: ExecutionContext, ExecutionError
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(comment:, executor:) ⇒ ActionExecutor
constructor
A new instance of ActionExecutor.
Constructor Details
#initialize(comment:, executor:) ⇒ ActionExecutor
Returns a new instance of ActionExecutor.
8 9 10 11 |
# File 'app/services/collavre/comments/action_executor.rb', line 8 def initialize(comment:, executor:) @comment = comment @executor = executor end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/collavre/comments/action_executor.rb', line 13 def call comment.with_lock do prepare_for_execution! execute_within_transaction! end rescue ExecutionError raise rescue StandardError, ScriptError => e Rails.logger.error("Comment action execution failed: #{e.class} #{e.}") raise ExecutionError, I18n.t("collavre.comments.approve_execution_failed", message: e.) end |