Permalink
Browse files

return :INVALID for bad numbers in load-int

  • Loading branch information...
1 parent 7de3038 commit f7198b170e541be099ff111b9b2c841da9a3b923 @alexgartrell committed Apr 18, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/tnetstrings/core.clj
View
4 src/tnetstrings/core.clj
@@ -31,7 +31,9 @@
data)
(defn- load-int [data]
- (Integer. data))
+ (try
+ (Integer. data)
+ (catch java.lang.NumberFormatException e :INVALID)))
(defn- load-bool [data]
(cond (= data "true") true

0 comments on commit f7198b1

Please sign in to comment.