Sha256: 7e3ac9e80d9213bb4d0f1a602d5cd66ad79ffee20218118811b128b49bb5b5f4
Contents?: true
Size: 1006 Bytes
Versions: 4
Compression:
Stored size: 1006 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.try(object, :metadata) || command.metadata end def caused_by Utils.try(object, :caused_by) || command end def thrown_by return object if Utils.try(object, :executed?) Utils.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