Sha256: ed635c9cfd34fcefe81813f72a5bdc55c3f1853045203ae151d259a7e42c4c08

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

module Mashery
  class Exception < ::Exception
    def self.create(options = {})
      case options['code']
      when 1000 then ValidationException.new(options['data'])
      when 1001 then DuplicateObjectException.new("#{options['message']} (JSON-RPC error #{options['code']})")
      else JsonRpcException.new("#{options['message']} (JSON-RPC error #{options['code']})")
      end
    end
  end

  class HttpException < Exception
  end

  class JsonRpcException < Exception
  end

  class DuplicateObjectException < Exception
  end

  class ValidationException < Exception
    attr_reader :errors
    def initialize(errs= {})
      @errors = errs
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mashery-0.1.1 lib/mashery/exceptions.rb