2016-12-22 13:34:19 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mastodon
|
|
|
|
class Error < StandardError; end
|
2017-02-26 15:23:06 -07:00
|
|
|
class NotPermittedError < Error; end
|
|
|
|
class ValidationError < Error; end
|
2018-02-24 11:16:11 -07:00
|
|
|
class HostValidationError < ValidationError; end
|
2018-03-26 06:02:10 -06:00
|
|
|
class LengthValidationError < ValidationError; end
|
2018-04-23 01:16:38 -06:00
|
|
|
class DimensionsValidationError < ValidationError; end
|
2020-07-19 14:28:27 -06:00
|
|
|
class StreamValidationError < ValidationError; end
|
2017-04-03 14:54:46 -06:00
|
|
|
class RaceConditionError < Error; end
|
2020-03-08 08:17:39 -06:00
|
|
|
class RateLimitExceededError < Error; end
|
2022-04-08 13:21:49 -06:00
|
|
|
class SyntaxError < Error; end
|
2022-11-14 00:06:06 -07:00
|
|
|
class InvalidParameterError < Error; end
|
2017-07-19 17:59:07 -06:00
|
|
|
|
|
|
|
class UnexpectedResponseError < Error
|
2021-05-05 15:46:59 -06:00
|
|
|
attr_reader :response
|
|
|
|
|
2017-07-19 17:59:07 -06:00
|
|
|
def initialize(response = nil)
|
2021-05-05 15:46:59 -06:00
|
|
|
@response = response
|
|
|
|
|
2017-07-26 16:38:20 -06:00
|
|
|
if response.respond_to? :uri
|
|
|
|
super("#{response.uri} returned code #{response.code}")
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
2017-07-19 17:59:07 -06:00
|
|
|
end
|
|
|
|
end
|
2022-09-20 15:30:26 -06:00
|
|
|
|
|
|
|
class PrivateNetworkAddressError < HostValidationError
|
|
|
|
attr_reader :host
|
|
|
|
|
|
|
|
def initialize(host)
|
|
|
|
@host = host
|
|
|
|
super()
|
|
|
|
end
|
|
|
|
end
|
2016-12-22 13:34:19 -07:00
|
|
|
end
|