lib/glimmer/dsl/expression_handler.rb in glimmer-0.5.2 vs lib/glimmer/dsl/expression_handler.rb in glimmer-0.5.3

- old
+ new

@@ -21,21 +21,21 @@ # Handles interpretation of Glimmer DSL expression if expression supports it # If it succeeds, it returns the correct Glimmer DSL expression object # Otherwise, it forwards to the next handler configured via `#next=` method # If there is no handler next, then it raises an error def handle(parent, keyword, *args, &block) - Glimmer.logger.debug "Attempting to handle #{keyword}(#{args}) with #{@expression.class.name.split(":").last}" + Glimmer.logger&.debug "Attempting to handle #{keyword}(#{args}) with #{@expression.class.name.split(":").last}" if @expression.can_interpret?(parent, keyword, *args, &block) - Glimmer.logger.debug "#{@expression.class.name} will handle expression keyword #{keyword} with arguments #{args}" + Glimmer.logger&.debug "#{@expression.class.name} will handle expression keyword #{keyword} with arguments #{args}" return @expression elsif @next_expression_handler return @next_expression_handler.handle(parent, keyword, *args, &block) else # TODO see if we need a better response here (e.g. dev mode error raising vs production mode silent failure) message = "Glimmer keyword #{keyword} with args #{args} cannot be handled" message += " inside parent #{parent.inspect}" if parent message += "! Check the validity of the code." - # Glimmer.logger.error message + # Glimmer.logger&.error message raise InvalidKeywordError, message end end # Sets the next handler in the expression handler chain of responsibility