1
0

exceptions.rb 968 B

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