immutable_drop/errors: consolidate errors & fix syntax for raising
Addresses @envygeeks's comments:
bff1726a5a
This commit is contained in:
parent
1afbe9967d
commit
b70ea3ca5c
|
|
@ -33,8 +33,6 @@ require 'colorator'
|
||||||
SafeYAML::OPTIONS[:suppress_warnings] = true
|
SafeYAML::OPTIONS[:suppress_warnings] = true
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
StandardError = Class.new(::StandardError)
|
|
||||||
|
|
||||||
# internal requires
|
# internal requires
|
||||||
autoload :Cleaner, 'jekyll/cleaner'
|
autoload :Cleaner, 'jekyll/cleaner'
|
||||||
autoload :Collection, 'jekyll/collection'
|
autoload :Collection, 'jekyll/collection'
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Drops
|
module Drops
|
||||||
class ImmutableDrop < Liquid::Drop
|
class ImmutableDrop < Liquid::Drop
|
||||||
IllegalDropModification = Class.new(Jekyll::StandardError)
|
|
||||||
|
|
||||||
def initialize(obj)
|
def initialize(obj)
|
||||||
@obj = obj
|
@obj = obj
|
||||||
end
|
end
|
||||||
|
|
@ -19,7 +17,7 @@ module Jekyll
|
||||||
|
|
||||||
def []=(key, val)
|
def []=(key, val)
|
||||||
if respond_to? key
|
if respond_to? key
|
||||||
raise IllegalDropModification.new("Key #{key} cannot be set in the drop.")
|
raise DropMutationException, "Key #{key} cannot be set in the drop."
|
||||||
else
|
else
|
||||||
fallback_data[key] = val
|
fallback_data[key] = val
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Errors
|
module Errors
|
||||||
class FatalException < RuntimeError
|
FatalException = Class.new(::RuntimeError)
|
||||||
end
|
|
||||||
|
|
||||||
class MissingDependencyException < FatalException
|
MissingDependencyException = Class.new(FatalException)
|
||||||
end
|
DropMutationException = Class.new(FatalException)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue