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