Sha256: b21f99230addea4cab6be9cb5f163a68cf9ed50a139ceb8dca1d52c72f93cce5
Contents?: true
Size: 1022 Bytes
Versions: 4
Compression:
Stored size: 1022 Bytes
Contents
# frozen_string_literal: true module Lite module Command class FaultStreamer attr_reader :command, :object def initialize(command, object) @command = command @object = object end def reason if object.respond_to?(:reason) object.reason elsif object.is_a?(StandardError) Utils.pretty_exception(object) else object end end def metadata Utils.cmd_try(object, :metadata) || command.metadata end def caused_by Utils.cmd_try(object, :caused_by) || command end def thrown_by return object if Utils.cmd_try(object, :executed?) Utils.cmd_try(object, :thrown_by) || command.caused_by end def command_exception return if command.success? Fault.build( command.status.capitalize, command, object, dynamic: command.send(:raise_dynamic_faults?) ) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems