From 0fdfe5df3f7fc0c482013ffead273abd46a7ad61 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Wed, 13 Jul 2011 00:20:16 -0700 Subject: use STDOUT for errors, avoid unnecessary raise and exception --- lib/hcl/app.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb index c1a6e9b..40009d6 100644 --- a/lib/hcl/app.rb +++ b/lib/hcl/app.rb @@ -39,8 +39,6 @@ module HCl SETTINGS_FILE = "#{ENV['HOME']}/.hcl_settings" CONFIG_FILE = "#{ENV['HOME']}/.hcl_config" - class UnknownCommand < StandardError; end - def initialize read_config read_settings @@ -73,16 +71,17 @@ module HCl end end else - raise UnknownCommand, "unrecognized command `#{@command}'" + STDERR.puts "unrecognized command `#{@command}'" + exit 1 end else show end rescue RuntimeError => e - puts "Error: #{e}" + STDERR.puts "Error: #{e}" exit 1 rescue TimesheetResource::Failure => e - puts "Internal failure. #{e}" + STDERR.puts "Internal failure. #{e}" exit 1 end end -- cgit v1.2.3