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