mirror of https://github.com/tootsuite/mastodon
Improve handling of libvips failures (#30597)
parent
80cd001e0a
commit
82be5d033f
|
@ -12,6 +12,8 @@ module Paperclip
|
||||||
attachment.instance.blurhash = Blurhash.encode(width, height, data, **(options[:blurhash] || {}))
|
attachment.instance.blurhash = Blurhash.encode(width, height, data, **(options[:blurhash] || {}))
|
||||||
|
|
||||||
@file
|
@file
|
||||||
|
rescue Vips::Error => e
|
||||||
|
raise Paperclip::Error, "Error while generating blurhash for #{@basename}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -69,6 +69,8 @@ module Paperclip
|
||||||
attachment.instance.file.instance_write(:meta, (attachment.instance.file.instance_read(:meta) || {}).merge(meta))
|
attachment.instance.file.instance_write(:meta, (attachment.instance.file.instance_read(:meta) || {}).merge(meta))
|
||||||
|
|
||||||
@file
|
@file
|
||||||
|
rescue Vips::Error => e
|
||||||
|
raise Paperclip::Error, "Error while extracting colors for #{@basename}: #{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Paperclip
|
||||||
end
|
end
|
||||||
|
|
||||||
dst
|
dst
|
||||||
rescue Terrapin::ExitStatusError => e
|
rescue Vips::Error, Terrapin::ExitStatusError => e
|
||||||
raise Paperclip::Error, "Error while optimizing #{@basename}: #{e}"
|
raise Paperclip::Error, "Error while optimizing #{@basename}: #{e}"
|
||||||
rescue Terrapin::CommandNotFoundError
|
rescue Terrapin::CommandNotFoundError
|
||||||
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffmpeg` command. Please install ffmpeg.'
|
raise Paperclip::Errors::CommandNotFoundError, 'Could not run the `ffmpeg` command. Please install ffmpeg.'
|
||||||
|
|
Loading…
Reference in New Issue