Commit 0cbc9681bef893f5c215b8977c4ab6d0268aa7e4
1 parent
49468ce4
Exists in
master
and in
1 other branch
Added more info to ApiVersionError, and parsed['version'] should be tested as a string.
Showing
1 changed file
with
4 additions
and
3 deletions
Show diff stats
lib/hoptoad.rb
| ... | ... | @@ -3,14 +3,14 @@ module Hoptoad |
| 3 | 3 | require 'digest/md5' |
| 4 | 4 | |
| 5 | 5 | class ApiVersionError < StandardError |
| 6 | - def initialize | |
| 7 | - super "Wrong API Version: Expecting v2.0" | |
| 6 | + def initialize(version) | |
| 7 | + super "Wrong API Version: Expecting v2.0, got version: #{version}" | |
| 8 | 8 | end |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | 11 | def self.parse_xml(xml) |
| 12 | 12 | parsed = ActiveSupport::XmlMini.backend.parse(xml)['notice'] |
| 13 | - raise ApiVersionError unless parsed && parsed['version'] == '2.0' | |
| 13 | + raise ApiVersionError(parsed['version']) unless parsed && parsed['version'].to_s == '2.0' | |
| 14 | 14 | rekeyed = rekey(parsed) |
| 15 | 15 | rekeyed['fingerprint'] = Digest::MD5.hexdigest(rekeyed['error']['backtrace'].to_s) |
| 16 | 16 | rekeyed |
| ... | ... | @@ -43,3 +43,4 @@ module Hoptoad |
| 43 | 43 | end |
| 44 | 44 | end |
| 45 | 45 | end |
| 46 | + | ... | ... |