Sha256: 809ec3248ba623ea9797f134715f7462f1a4c159b15465fc29ff0ca6cae93b89

Contents?: true

Size: 1.61 KB

Versions: 17

Compression:

Stored size: 1.61 KB

Contents

module Bobot
  # Base Facebook Messenger exception.
  class Error < ::StandardError; end

  class FieldFormat < ::ArgumentError
    def initialize(description, value = nil)
      super("#{description}#{value.present? ? " : #{value}'" : ''}")
    end
  end

  # Forbidden Action exception
  class ActionNotAllowed < Bobot::Error; end

  # Base error class for Facebook API errors.
  class FacebookError < Bobot::Error
    attr_reader :message
    attr_reader :type
    attr_reader :code
    attr_reader :subcode
    attr_reader :user_title
    attr_reader :user_msg
    attr_reader :fbtrace_id

    def initialize(error)
      @message = error['message']
      @type = error['type']
      @code = error['code']
      @subcode = error['error_subcode']
      @user_title = error['error_user_title']
      @user_msg = error['error_user_msg']
      @fbtrace_id = error['fbtrace_id']
    end

    def to_s
      message
    end
  end

  # Base Facebook Messenger send API exception.
  class SendError < Bobot::FacebookError; end

  class AccessTokenError < Bobot::SendError; end
  class AccountLinkingError < Bobot::SendError; end
  class BadParameterError < Bobot::SendError; end
  class InternalError < Bobot::SendError; end
  class LimitError < Bobot::SendError; end
  class PermissionError < Bobot::SendError; end

  # Base Facebook Messenger exception.
  class NetworkError < ::StandardError
    attr_reader :response
    attr_reader :description

    def initialize(response, description)
      @response = response
      @description = description
    end

    def message
      description
    end

    def to_s
      message
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bobot-4.9.0 lib/bobot/exceptions.rb
bobot-4.8.0 lib/bobot/exceptions.rb
bobot-4.7.0 lib/bobot/exceptions.rb
bobot-4.6.0 lib/bobot/exceptions.rb
bobot-4.5.0 lib/bobot/exceptions.rb
bobot-4.4.1 lib/bobot/exceptions.rb
bobot-4.4.0 lib/bobot/exceptions.rb
bobot-4.3.1 lib/bobot/exceptions.rb
bobot-4.3.0 lib/bobot/exceptions.rb
bobot-4.2.0 lib/bobot/exceptions.rb
bobot-4.1.0 lib/bobot/exceptions.rb
bobot-4.0.0 lib/bobot/exceptions.rb
bobot-3.7.9 lib/bobot/exceptions.rb
bobot-3.7.8 lib/bobot/exceptions.rb
bobot-3.7.6 lib/bobot/exceptions.rb
bobot-3.7.3 lib/bobot/exceptions.rb
bobot-3.7.2 lib/bobot/exceptions.rb