Sha256: df6748e0a3d22f68be40a784fbee5a93978fc1d704c88bbbf228c8c5935dccaa
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module Redd # An error with the API. class APIError < StandardError attr_reader :response, :name def initialize(response) @response = response @name, message = response.body[:json][:errors][0] super(message) end end # Represents an error from reddit returned in a response. class ResponseError < StandardError attr_accessor :response def initialize(response) super(response.raw_body.length <= 80 ? response.raw_body : "#{response.raw_body[0..80]}...") @response = response end end # An error with Redd, probably (let me know!) class BadRequest < ResponseError; end # Whatever it is, you're not allowed to do it. class Forbidden < ResponseError; end # You don't have the correct scope to do this. class InsufficientScope < ResponseError; end # The access object supplied was invalid. class InvalidAccess < ResponseError; end # Returned when reddit raises a 404 error. class NotFound < ResponseError; end # An unknown error on reddit's end. Usually fixed with a retry. class ServerError < ResponseError; end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
redd-0.8.3 | lib/redd/error.rb |
redd-0.8.2 | lib/redd/error.rb |
redd-0.8.1 | lib/redd/error.rb |
redd-0.8.0 | lib/redd/error.rb |
redd-0.8.0.pre.2 | lib/redd/error.rb |