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.



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

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.



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

def operation_result
  @operation_result
end

Instance Method Details

#sentry_contextObject



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

def sentry_context
  operation_result.as_json(include_command: true)
end