Sha256: a18ce0d9282340f982d7f2dffde0010253fc878d89b35a0501be4d4723f212c6

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

module TeamworkApi
  class TeamworkError < StandardError
    attr_reader :response

    def initialize(message, response = nil)
      super(message)
      @response = response
    end
  end

  class Error < TeamworkError
    attr_reader :wrapped_exception

    # Initializes a new Error object
    #
    # @param exception [Exception, String]
    # @return [TeamworkApi::Error]
    def initialize(exception = $!)
      @wrapped_exception = exception
      if exception.respond_to?(:message)
        super(exception.message)
      else
        super(exception.to_s)
      end
    end
  end

  class UnauthenticatedError < TeamworkError
  end

  class NotFoundError < TeamworkError
  end

  class UnprocessableEntity < TeamworkError
  end

  class TooManyRequests < TeamworkError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teamwork_api-0.1.0 lib/teamwork_api/error.rb