Module: Nginxtra::Error

Defined in:
lib/nginxtra/error.rb

Defined Under Namespace

Classes: Base, ConvertFailed, IllegalState, InvalidCompilationOption, InvalidConfig, InvalidPartialArguments, MissingConfig, MissingNginxConfig, MissingPassengerGem, NginxDetected, NginxInitScriptMissing, NoConfigSpecified, RunFailed, UndeterminedNginxBinary

Class Method Summary collapse

Class Method Details



120
121
122
123
124
# File 'lib/nginxtra/error.rb', line 120

def print_error(thor, options)
  text = "" << thor.set_color(options[:header], :red, true)
  text << "\n\n" << thor.set_color(options[:message], :red, false) if options[:message]
  thor.print_wrapped text
end

.protect(thor) ⇒ Object



126
127
128
129
130
131
132
133
134
# File 'lib/nginxtra/error.rb', line 126

def protect(thor)
  yield
rescue Nginxtra::Error::Base => e
  e.output thor
  raise if thor.options["trace"]
rescue
  print_error thor, header: "An unexpected error occurred!"
  raise if thor.options["trace"]
end