Exception: Operations::Command::OperationFailed

Inherits:
StandardError
  • Object
show all
Defined in:
lib/operations/command.rb

Overview

Provides message and meaningful sentry context for failed operations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation_result) ⇒ OperationFailed

Returns a new instance of OperationFailed.



142
143
144
145
146
147
# File 'lib/operations/command.rb', line 142

def initialize(operation_result)
  @operation_result = operation_result
  operation_class_name = operation_result.operation&.operation&.class&.name

  super("#{operation_class_name} failed on #{operation_result.component}")
end

Instance Attribute Details

#operation_resultObject (readonly)

Returns the value of attribute operation_result.



140
141
142
# File 'lib/operations/command.rb', line 140

def operation_result
  @operation_result
end

Instance Method Details

#sentry_contextObject



149
150
151
# File 'lib/operations/command.rb', line 149

def sentry_context
  operation_result.as_json(include_command: true)
end