Module: Nginxtra::Error
- Defined in:
- lib/nginxtra/error.rb
Defined Under Namespace
Classes: Base, ConvertFailed, IllegalState, InvalidConfig, MissingConfig, NginxDetected, RunFailed
Class Method Summary
collapse
Class Method Details
.print_error(thor, options) ⇒ Object
38
39
40
41
42
|
# File 'lib/nginxtra/error.rb', line 38
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
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/nginxtra/error.rb', line 44
def protect(thor)
begin
yield
rescue Nginxtra::Error::Base => e
e.output thor
raise if thor.options["trace"]
rescue => e
print_error thor, :header => "An unexpected error occurred!"
raise if thor.options["trace"]
end
end
|