Warn when image doesn't exist instead of throwing SyntaxError
This commit is contained in:
parent
48c36e75b9
commit
91a540c266
|
@ -56,4 +56,4 @@ Feature: Jekyll responsive_image_block tag
|
||||||
path: {{ path }}
|
path: {{ path }}
|
||||||
{% endresponsive_image_block %}
|
{% endresponsive_image_block %}
|
||||||
"""
|
"""
|
||||||
Then Jekyll should throw a "SyntaxError"
|
Then Jekyll should throw a "Magick::ImageMagickError"
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Jekyll
|
||||||
def process(image_path, config)
|
def process(image_path, config)
|
||||||
absolute_image_path = File.expand_path(image_path.to_s, config[:site_source])
|
absolute_image_path = File.expand_path(image_path.to_s, config[:site_source])
|
||||||
|
|
||||||
raise SyntaxError.new("Invalid image path specified: #{image_path}") unless File.file?(absolute_image_path)
|
Jekyll.logger.warn "Invalid image path specified: #{image_path.inspect}" unless File.file?(absolute_image_path)
|
||||||
|
|
||||||
resize_handler = ResizeHandler.new
|
resize_handler = ResizeHandler.new
|
||||||
img = Magick::Image::read(absolute_image_path).first
|
img = Magick::Image::read(absolute_image_path).first
|
||||||
|
|
Loading…
Reference in New Issue