From bff1726a5a24551164d958eca93983b96a975203 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 24 Dec 2015 15:06:32 -0500 Subject: [PATCH] immutable_drop: use custom error for bad set --- lib/jekyll.rb | 1 + lib/jekyll/drops/immutable_drop.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index a90a5a0b..de6b6c69 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -32,6 +32,7 @@ require 'colorator' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll + StandardError = Class.new(::StandardError) # internal requires autoload :Cleaner, 'jekyll/cleaner' diff --git a/lib/jekyll/drops/immutable_drop.rb b/lib/jekyll/drops/immutable_drop.rb index d7948beb..630cbfe1 100644 --- a/lib/jekyll/drops/immutable_drop.rb +++ b/lib/jekyll/drops/immutable_drop.rb @@ -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