From 0b2c565cff2f4496c69fe057da4f6d1284eafdf1 Mon Sep 17 00:00:00 2001 From: Roguelearg Date: Thu, 14 Sep 2017 15:36:59 +0200 Subject: [PATCH] Add eval_error --- lib/errors/var_not_defined.rb | 7 +++++++ lib/mm2ep_depend.rb | 2 ++ lib/mm2ep_depend/eval_error.rb | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 lib/errors/var_not_defined.rb create mode 100644 lib/mm2ep_depend/eval_error.rb diff --git a/lib/errors/var_not_defined.rb b/lib/errors/var_not_defined.rb new file mode 100644 index 0000000..11c0ed5 --- /dev/null +++ b/lib/errors/var_not_defined.rb @@ -0,0 +1,7 @@ +module Mm2ep + module Depend + class VarNotDefined < Depend::EvalError + + end + end +end diff --git a/lib/mm2ep_depend.rb b/lib/mm2ep_depend.rb index 77d76bc..ef6197f 100644 --- a/lib/mm2ep_depend.rb +++ b/lib/mm2ep_depend.rb @@ -8,3 +8,5 @@ require 'rly' require 'mm2ep_depend/lexer' require 'mm2ep_depend/parser' +require 'mm2ep_depend/eval_error' +require 'errors/var_not_defined' diff --git a/lib/mm2ep_depend/eval_error.rb b/lib/mm2ep_depend/eval_error.rb new file mode 100644 index 0000000..df75bcb --- /dev/null +++ b/lib/mm2ep_depend/eval_error.rb @@ -0,0 +1,18 @@ +module Mm2ep + module Depend + class EvalError + attr_accessor :var + attr_accessor :message + + def initialize(hash) + # validate input + raise ArgumentError unless hash[:message] + + # load input + @message = hash[:message] + @var = hash[:var] + end + + end + end +end