Fix "NameError: uninitialized constant Exceptions"
Zeitwerk operates on files in the autoload paths. Since the entire "app" directory is autoloaded, all files inside need to play by Zeitwerk's rules. Zeitwerk expects that a file named "exceptions.rb" would define a constant named "Exceptions". The exceptions file doesn't follow Zeitwerk's conventions. The easiest way to solve this is to move the execptions out of app/lib and into lib, where `require_relative` doesn't have Zeitwerk taken into account.
This commit is contained in:
21
lib/exceptions.rb
Normal file
21
lib/exceptions.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module GabSocial
|
||||
class Error < StandardError; end
|
||||
class NotPermittedError < Error; end
|
||||
class ValidationError < Error; end
|
||||
class HostValidationError < ValidationError; end
|
||||
class LengthValidationError < ValidationError; end
|
||||
class DimensionsValidationError < ValidationError; end
|
||||
class RaceConditionError < Error; end
|
||||
|
||||
class UnexpectedResponseError < Error
|
||||
def initialize(response = nil)
|
||||
if response.respond_to? :uri
|
||||
super("#{response.uri} returned code #{response.code}")
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user