lib/command.rb in g2_command-0.3.0 vs lib/command.rb in g2_command-0.4.0

- old
+ new

@@ -3,10 +3,11 @@ require 'active_support/core_ext/string' require 'active_model' require 'dry-initializer' require 'dry-monads' +require 'command/failure' require 'command/input_middleware' require 'command/interrupt' module Command extend ActiveSupport::Concern @@ -32,16 +33,16 @@ rescue Command::Interrupt => e errors.merge! e.errors end end - errors.empty? ? Success(result) : Failure(errors) + errors.empty? ? Success(result) : Failure(Command::Failure.new(result, errors)) end def compose(command, *args) outcome = command.run(*args) - raise Command::Interrupt, outcome.failure if outcome.failure? + raise Command::Interrupt, outcome.failure.errors if outcome.failure? outcome.value! end def inputs