Exception raised when a storage operation fails.
This covers errors from any storage backend (local disk, S3, memory, or custom adapters) such as failed reads, writes, deletes, or connectivity issues.
Fields
:message— human-readable error description:reason— machine-readable atom identifying the error (e.g.:write_failed,:not_found):operation— the storage operation that failed (e.g.:put,:get,:delete,:exists?):path— the storage path involved, if available:adapter— the storage adapter module that raised the error, if available:metadata— optional map with additional context
Examples
iex> raise PhxMediaLibrary.StorageError,
...> message: "failed to write file",
...> reason: :write_failed,
...> operation: :put,
...> path: "posts/abc/image.jpg"
** (PhxMediaLibrary.StorageError) failed to write file
iex> error = %PhxMediaLibrary.StorageError{
...> message: "file not found",
...> reason: :not_found,
...> operation: :get,
...> path: "posts/abc/image.jpg"
...> }
iex> error.reason
:not_found