diff options
| author | Zack Hobson | 2011-07-13 00:20:16 -0700 |
|---|---|---|
| committer | Zack Hobson | 2011-07-13 00:20:16 -0700 |
| commit | 0fdfe5df3f7fc0c482013ffead273abd46a7ad61 (patch) | |
| tree | f03bb14820969fb8baad6df70fd26366e24f23fe | |
| parent | 711585fc5547b75e865028ba51f5d0b9669a28a6 (diff) | |
| download | hcl-0fdfe5df3f7fc0c482013ffead273abd46a7ad61.tar.bz2 | |
use STDOUT for errors, avoid unnecessary raise and exception
| -rw-r--r-- | CHANGELOG | 4 | ||||
| -rw-r--r-- | lib/hcl/app.rb | 9 |
2 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,9 @@ = Recent Changes in HCl +== v0.2.4 + +* use STDERR instead of STDOUT for error reporting + == v0.2.3 Sun Aug 23 21:39:34 2009 -0700 * Allow decimal time offset without a dot, closes #29. 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 |
