lib/papertrail/cli_helpers.rb in papertrail-0.9.9 vs lib/papertrail/cli_helpers.rb in papertrail-0.9.10
- old
+ new
@@ -1,14 +1,17 @@
module Papertrail
module CliHelpers
def find_configfile
- if File.exists?(path = File.expand_path('.papertrail.yml'))
- return path
+ begin
+ if File.exists?(path = File.expand_path('.papertrail.yml'))
+ return path
+ end
+ if File.exists?(path = File.expand_path('~/.papertrail.yml'))
+ return path
+ end
+ rescue ArgumentError => e
end
- if File.exists?(path = File.expand_path('~/.papertrail.yml'))
- return path
- end
end
def load_configfile(file_path)
symbolize_keys(YAML.load_file(file_path))
end
@@ -30,7 +33,14 @@
def parse_time(tstring)
Chronic.parse(tstring) ||
raise(ArgumentError, "Could not parse time string '#{tstring}'")
end
+ def output_http_error(e)
+ if e.response && e.response.body
+ puts "Error: #{e.response.body}\n\n"
+ end
+
+ puts e
+ end
end
end