Sha256: e017da89e27330eec46ae56953dbc1af6662562790f8541416c62a559b0da2c5

Contents?: true

Size: 758 Bytes

Versions: 11

Compression:

Stored size: 758 Bytes

Contents

module DiscourseApi
  class DiscourseError < StandardError
    attr_reader :response

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

  class Error < DiscourseError
    attr_reader :wrapped_exception

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

  class UnauthenticatedError < DiscourseError
  end

  class NotFoundError < DiscourseError
  end

  class UnprocessableEntity < DiscourseError
  end

  class TooManyRequests < DiscourseError
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
discourse_api-0.34.0 lib/discourse_api/error.rb
discourse_api-0.33.0 lib/discourse_api/error.rb
discourse_api-0.32.0 lib/discourse_api/error.rb
discourse_api-0.31.0 lib/discourse_api/error.rb
discourse_api-0.30.0 lib/discourse_api/error.rb
discourse_api-0.29.0 lib/discourse_api/error.rb
discourse_api-0.28.1 lib/discourse_api/error.rb
discourse_api-0.28.0 lib/discourse_api/error.rb
discourse_api-0.27.0 lib/discourse_api/error.rb
discourse_api-0.26.0 lib/discourse_api/error.rb
discourse_api-0.25.0 lib/discourse_api/error.rb