immutable_drop/errors: consolidate errors & fix syntax for raising

Addresses @envygeeks's comments:
bff1726a5a
This commit is contained in:
Parker Moore 2015-12-26 12:27:07 -05:00
parent 1afbe9967d
commit b70ea3ca5c
3 changed files with 4 additions and 9 deletions

View File

@ -33,8 +33,6 @@ require 'colorator'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
StandardError = Class.new(::StandardError)
# internal requires
autoload :Cleaner, 'jekyll/cleaner'
autoload :Collection, 'jekyll/collection'

View File

@ -3,8 +3,6 @@
module Jekyll
module Drops
class ImmutableDrop < Liquid::Drop
IllegalDropModification = Class.new(Jekyll::StandardError)
def initialize(obj)
@obj = obj
end
@ -19,7 +17,7 @@ module Jekyll
def []=(key, val)
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
fallback_data[key] = val
end

View File

@ -1,9 +1,8 @@
module Jekyll
module Errors
class FatalException < RuntimeError
end
FatalException = Class.new(::RuntimeError)
class MissingDependencyException < FatalException
end
MissingDependencyException = Class.new(FatalException)
DropMutationException = Class.new(FatalException)
end
end