Exception: Discorb::CloudFlareBanError

Inherits:
HTTPError show all
Defined in:
lib/discorb/error.rb

Overview

Represents a error because of a cloudflare ban.

Instance Attribute Summary

Attributes inherited from HTTPError

#response

Instance Method Summary collapse

Methods inherited from HTTPError

#code

Constructor Details

#initialize(resp, client) -> CloudFlareBanError

Returns a new instance of CloudFlareBanError.



95
96
97
98
99
100
101
102
103
104
# File 'lib/discorb/error.rb', line 95

def initialize(resp, client)
  @client = client
  @client.close!
  message = <<~MESSAGE
    The client is banned from CloudFlare.
    Hint: Try to decrease the number of requests per second, e.g. Use sleep in between requests.
  MESSAGE
  $stderr.puts message
  DiscorbError.instance_method(:initialize).bind(self).call(message)
end