Sha256: c562b0387e95d1747d204445702ab1a5c77847342cebfbce01821b8f7a8a9ff7
Contents?: true
Size: 602 Bytes
Versions: 2
Compression:
Stored size: 602 Bytes
Contents
class WoopraError < StandardError class << self def json_exception?(e) e.class == JSON::ParserError end def account_exception?(json) ["host", "not registered!"].all?{|w| json.downcase.include? w } end def get_error(e, json) if json_exception?(e) && account_exception?(json) raise WoopraError, "Your account is incorrect. Woopra responded that '#{WoopraRails.account}'' was not registered." elsif json_exception?(e) ::Rails.logger.debug("JSON::ParserError in WoopraRails. Not raising, but you should check.") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
woopra_rails-1.2.1 | lib/woopra_rails/error.rb |
woopra_rails-1.2 | lib/woopra_rails/error.rb |