Class: Uma::CLI::ErrorResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/uma/cli.rb

Instance Attribute Summary

Attributes inherited from Base

#argv, #env

Instance Method Summary collapse

Methods inherited from Base

#print_message

Constructor Details

#initialize(error, argv, env) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



88
89
90
91
92
# File 'lib/uma/cli.rb', line 88

def initialize(error, argv, env)
  @error = error
  @argv = argv
  @env = env
end

Instance Method Details

#runObject



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/uma/cli.rb', line 94

def run
  error_msg = @error.message
  if error_msg.empty?
    print_message(env[:io_err], CLI_HELP)
  else
    print_message(
      env[:io_err], ERROR_RESPONSE_TEMPLATE,
      error_msg:
    )
  end
end