lib/nanoc/helpers/link_to.rb in nanoc-3.3.4 vs lib/nanoc/helpers/link_to.rb in nanoc-3.3.5

- old
+ new

@@ -119,20 +119,24 @@ # Find path if target.is_a?(String) path = target else path = target.path - raise RuntimeError, "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil? + if path.nil? + raise "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)" + end end # Handle Windows network (UNC) paths if path.start_with?('//') || path.start_with?('\\\\') return path end # Get source and destination paths dst_path = Pathname.new(path) - raise RuntimeError, "Cannot get the relative path to #{path} because the current item representation, #{@item_rep.inspect}, is not outputted (its routing rule returns nil)" if @item_rep.path.nil? + if @item_rep.path.nil? + raise "Cannot get the relative path to #{path} because the current item representation, #{@item_rep.inspect}, is not outputted (its routing rule returns nil)" + end src_path = Pathname.new(@item_rep.path) # Calculate the relative path (method depends on whether destination is # a directory or not). if src_path.to_s[-1,1] != '/'