shrinerb / shrine

File Attachment toolkit for Ruby applications

Home Page:https://shrinerb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SHRINE WARNING: Error occurred when attempting to extract image dimensions: #<FastImage::UnknownImageType: FastImage::UnknownImageType> not using error handler

h0jeZvgoxFepBQ2C opened this issue · comments

Brief Description

During an image check, we get an unhandled exception:

SHRINE WARNING: Error occurred when attempting to extract image dimensions: #<FastImage::UnknownImageType: FastImage::UnknownImageType>

Expected behavior

Use the error callback

Actual behavior

Is raising an exception

Simplest self-contained example code to demonstrate issue

I guess we just have to add FastImage::UnknownImageType to the rescue clause here:

rescue FastImage::FastImageException => error

System configuration

Ruby version:
2.6.6

Shrine version:

Workarount:

  plugin :store_dimensions, analyzer: -> (io, analyzers) do
    begin
      dimensions   = analyzers[:fastimage].call(io)   # try extracting dimensions with FastImage
    rescue => e
      puts e
    end
    dimensions
  end

Sorry, I was just wrong.