Skip to content

Commit

Permalink
use STDOUT for errors, avoid unnecessary raise and exception
Browse files Browse the repository at this point in the history
  • Loading branch information
zenhob committed Jul 13, 2011
1 parent 711585f commit 0fdfe5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -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.
Expand Down
9 changes: 4 additions & 5 deletions lib/hcl/app.rb
Expand Up @@ -39,8 +39,6 @@ class App
SETTINGS_FILE = "#{ENV['HOME']}/.hcl_settings"
CONFIG_FILE = "#{ENV['HOME']}/.hcl_config"

class UnknownCommand < StandardError; end

def initialize
read_config
read_settings
Expand Down Expand Up @@ -73,16 +71,17 @@ def run
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
Expand Down

0 comments on commit 0fdfe5d

Please sign in to comment.