Skip to content

Commit

Permalink
Ruby 1.8 treats Integer(nil) as 0, and 1.9 treats it as nil. Switch t…
Browse files Browse the repository at this point in the history
…o default gracefully.
  • Loading branch information
smarterclayton committed Apr 10, 2013
1 parent 50ec448 commit 266f3ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rhc/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Exception < RuntimeError
attr_reader :code
def initialize(message=nil, code=1)
super(message)
@code = (Integer(code) rescue code)
@code = (Integer(code) rescue nil)
end
end

Expand Down Expand Up @@ -68,7 +68,7 @@ def initialize(msg)
#Exceptions thrown in case of an HTTP 422 is received.
class ValidationException < ClientErrorException
attr_reader :field
def initialize(message, field=nil, error_code=nil)
def initialize(message, field=nil, error_code=1)
super(message, error_code)
@field = field
end
Expand Down

0 comments on commit 266f3ca

Please sign in to comment.