lib/gli/app_support.rb in gli-2.6.2 vs lib/gli/app_support.rb in gli-2.7.0

- old
+ new

@@ -209,10 +209,12 @@ if ex.kind_of?(OptionParser::ParseError) || ex.kind_of?(BadCommandLine) if commands[:help] commands[:help].execute({},{},command.nil? ? [] : [command.name.to_s]) end end + elsif ENV['GLI_DEBUG'] == 'true' + stderr.puts "Custom error handler exited false, skipping normal error handling" end raise ex if ENV['GLI_DEBUG'] == 'true' ex.extend(GLI::StandardException) @@ -252,10 +254,11 @@ end # Returns true if we should proceed with GLI's basic error handling. # This calls the error block if the user provided one def regular_error_handling?(ex) #:nodoc: - if @error_block + if @error_block + return true if (ex.respond_to?(:exit_code) && ex.exit_code == 0) @error_block.call(ex) else true end end