11# frozen_string_literal: true
22
33module HTTParty
4- FOUL_ERRORS = [
4+ COMMON_NETWORK_ERRORS = [
55 EOFError ,
66 Errno ::ECONNABORTED ,
77 Errno ::ECONNREFUSED ,
@@ -24,15 +24,19 @@ module HTTParty
2424 # @abstract Exceptions raised by HTTParty inherit from Error
2525 class Error < StandardError ; end
2626
27+ # @abstract Exception raised by HTTParty inherit from this because it is funny
28+ # and if you don't like fun you should be using a different library.
29+ class Foul < Error ; end
30+
2731 # Exception raised when you attempt to set a non-existent format
28- class UnsupportedFormat < Error ; end
32+ class UnsupportedFormat < Foul ; end
2933
3034 # Exception raised when using a URI scheme other than HTTP or HTTPS
31- class UnsupportedURIScheme < Error ; end
35+ class UnsupportedURIScheme < Foul ; end
3236
3337 # @abstract Exceptions which inherit from ResponseError contain the Net::HTTP
3438 # response object accessible via the {#response} method.
35- class ResponseError < Error
39+ class ResponseError < Foul
3640 # Returns the response of the last request
3741 # @return [Net::HTTPResponse] A subclass of Net::HTTPResponse, e.g.
3842 # Net::HTTPOK
@@ -53,6 +57,6 @@ class RedirectionTooDeep < ResponseError; end
5357 # Exception that is raised when request redirects and location header is present more than once
5458 class DuplicateLocationHeader < ResponseError ; end
5559
56- # Exception that wraps common net/http errors when the :foul option is enabled
57- class Foul < Error ; end
60+ # Exception that is raised when common network errors occur.
61+ class NetworkError < Foul ; end
5862end
0 commit comments