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