immutable_drop: use custom error for bad set
This commit is contained in:
parent
6a72d4a986
commit
bff1726a5a
|
@ -32,6 +32,7 @@ require 'colorator'
|
|||
SafeYAML::OPTIONS[:suppress_warnings] = true
|
||||
|
||||
module Jekyll
|
||||
StandardError = Class.new(::StandardError)
|
||||
|
||||
# internal requires
|
||||
autoload :Cleaner, 'jekyll/cleaner'
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module Jekyll
|
||||
module Drops
|
||||
class ImmutableDrop < Liquid::Drop
|
||||
IllegalDropModification = Class.new(Jekyll::StandardError)
|
||||
|
||||
def initialize(obj)
|
||||
@obj = obj
|
||||
|
@ -18,7 +19,7 @@ module Jekyll
|
|||
|
||||
def []=(key, val)
|
||||
if respond_to? key
|
||||
raise ArgumentError.new("Key #{key} cannot be set in the drop.")
|
||||
raise IllegalDropModification.new("Key #{key} cannot be set in the drop.")
|
||||
else
|
||||
fallback_data[key] = val
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue