lib/dexter/client.rb in pgdexter-0.3.7 vs lib/dexter/client.rb in pgdexter-0.3.8
- old
+ new
@@ -1,15 +1,16 @@
module Dexter
class Client
+ extend Logging
include Logging
attr_reader :arguments, :options
def self.start
Dexter::Client.new(ARGV).perform
- rescue Dexter::Abort => e
- abort e.message
+ rescue Dexter::Abort, PG::UndefinedFile => e
+ abort colorize(e.message.strip, :red)
end
def initialize(args)
@arguments, @options = parse_args(args)
end
@@ -76,13 +77,13 @@
options[:dbname] = arguments.shift unless options[:dbname]
# TODO don't use global var
$log_level = options[:log_level].to_s.downcase
- abort "Unknown log level" unless ["error", "info", "debug", "debug2", "debug3"].include?($log_level)
+ raise Dexter::Abort, "Unknown log level" unless ["error", "info", "debug", "debug2", "debug3"].include?($log_level)
[arguments, options]
rescue Slop::Error => e
- abort e.message
+ raise Dexter::Abort, e.message
end
end
end