Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Don't crash when only one line is given.

Don't print a backtrace when ::run fails, just the message then exit.
  • Loading branch information...
commit 182e4ab41767d496a312e6547f596cb719fa908c 1 parent 73fd3e3
Eric Hodel authored February 22, 2011

Showing 2 changed files with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  History.txt
  2. 6  lib/meme.rb
6  History.txt
... ...
@@ -1,3 +1,9 @@
  1
+=== 1.2.1 / 2011-02-22
  2
+
  3
+* Bug Fix
  4
+  * A proper error is now printed (instead of crashing) when `meme` is run
  5
+    without both lines.  Bug #7 by Trevor Hartman.
  6
+
1 7
 === 1.2 / 2011-02-11
2 8
 
3 9
 * Minor enhancements
6  lib/meme.rb
@@ -16,7 +16,7 @@ class Error < RuntimeError; end
16 16
   ##
17 17
   # Every meme generator needs a version
18 18
 
19  
-  VERSION = '1.2'
  19
+  VERSION = '1.2.1'
20 20
 
21 21
   ##
22 22
   # For statistics!
@@ -87,6 +87,8 @@ def self.run argv = ARGV
87 87
 
88 88
     puts link
89 89
     link
  90
+  rescue Exception => e
  91
+    abort "ERROR: #{e.message} (#{e.class})"
90 92
   end
91 93
 
92 94
   ##
@@ -111,7 +113,7 @@ def generate line1, line2 = nil
111 113
       line1 = @default_line
112 114
     end
113 115
 
114  
-    raise Error, "must supply both lines for #{generator_name}" unless line1
  116
+    raise Error, "two lines are required for #{@generator_name}" unless line1
115 117
 
116 118
     Net::HTTP.start url.host do |http|
117 119
       post = Net::HTTP::Post.new url.path

0 notes on commit 182e4ab

Please sign in to comment.
Something went wrong with that request. Please try again.