mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
5cd2d07bdc
`ActiveStorage::Blob#download` and `ActiveStorage::Blob#open` raise `ActiveStorage::FileNotFoundError` when the corresponding file is missing from the storage service. Services translate service-specific missing object exceptions (e.g. `Google::Cloud::NotFoundError` for the GCS service and `Errno::ENOENT` for the disk service) into `ActiveStorage::FileNotFoundError`.
26 lines
1.1 KiB
Ruby
26 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module ActiveStorage
|
|
# Generic base class for all Active Storage exceptions.
|
|
class Error < StandardError; end
|
|
|
|
# Raised when ActiveStorage::Blob#variant is called on a blob that isn't variable.
|
|
# Use ActiveStorage::Blob#variable? to determine whether a blob is variable.
|
|
class InvariableError < Error; end
|
|
|
|
# Raised when ActiveStorage::Blob#preview is called on a blob that isn't previewable.
|
|
# Use ActiveStorage::Blob#previewable? to determine whether a blob is previewable.
|
|
class UnpreviewableError < Error; end
|
|
|
|
# Raised when ActiveStorage::Blob#representation is called on a blob that isn't representable.
|
|
# Use ActiveStorage::Blob#representable? to determine whether a blob is representable.
|
|
class UnrepresentableError < Error; end
|
|
|
|
# Raised when uploaded or downloaded data does not match a precomputed checksum.
|
|
# Indicates that a network error or a software bug caused data corruption.
|
|
class IntegrityError < Error; end
|
|
|
|
# Raised when ActiveStorage::Blob#download is called on a blob where the
|
|
# backing file is no longer present in its service.
|
|
class FileNotFoundError < Error; end
|
|
end
|