From b70ea3ca5cf0769753d358c8f358a242f3b15cbe Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 26 Dec 2015 12:27:07 -0500 Subject: [PATCH] immutable_drop/errors: consolidate errors & fix syntax for raising Addresses @envygeeks's comments: https://github.com/jekyll/jekyll/commit/bff1726a5a24551164d958eca93983b96a975203 --- lib/jekyll.rb | 2 -- lib/jekyll/drops/immutable_drop.rb | 4 +--- lib/jekyll/errors.rb | 7 +++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 686aad3b..e3fca10b 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -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' diff --git a/lib/jekyll/drops/immutable_drop.rb b/lib/jekyll/drops/immutable_drop.rb index 630cbfe1..5440aa00 100644 --- a/lib/jekyll/drops/immutable_drop.rb +++ b/lib/jekyll/drops/immutable_drop.rb @@ -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 diff --git a/lib/jekyll/errors.rb b/lib/jekyll/errors.rb index dc5238a0..2b0dbc0c 100644 --- a/lib/jekyll/errors.rb +++ b/lib/jekyll/errors.rb @@ -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