exceptions.rb 1021 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 FilterValidationError < ValidationError; end
  11. class RaceConditionError < Error; end
  12. class RateLimitExceededError < Error; end
  13. class SyntaxError < Error; end
  14. class InvalidParameterError < Error; end
  15. class UnexpectedResponseError < Error
  16. attr_reader :response
  17. def initialize(response = nil)
  18. @response = response
  19. if response.respond_to? :uri
  20. super("#{response.uri} returned code #{response.code}")
  21. else
  22. super
  23. end
  24. end
  25. end
  26. class PrivateNetworkAddressError < HostValidationError
  27. attr_reader :host
  28. def initialize(host)
  29. @host = host
  30. super()
  31. end
  32. end
  33. end