exceptions.rb 772 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. module Mastodon
  3. class Error < StandardError; end
  4. class NotPermittedError < Error; end
  5. class ValidationError < Error; end
  6. class HostValidationError < ValidationError; end
  7. class LengthValidationError < ValidationError; end
  8. class DimensionsValidationError < ValidationError; end
  9. class StreamValidationError < ValidationError; end
  10. class RaceConditionError < Error; end
  11. class RateLimitExceededError < Error; end
  12. class SyntaxError < Error; end
  13. class UnexpectedResponseError < Error
  14. attr_reader :response
  15. def initialize(response = nil)
  16. @response = response
  17. if response.respond_to? :uri
  18. super("#{response.uri} returned code #{response.code}")
  19. else
  20. super
  21. end
  22. end
  23. end
  24. end