View Source FileStore.Middleware.Errors (file_store v0.4.0)
By default, each adapter will return errors in a different format. This middleware attempts to make the errors returned by this library a little more useful by wrapping them in exception structs:
Each of these structs contain reason field, where you'll find the original
error that was returned by the underlying adapter.
One nice feature of this middleware is that it makes it easy to raise:
store
|> FileStore.Middleware.Errors.new()
|> FileStore.read("example.jpg")
|> case do
{:ok, data} -> data
{:error, error} -> raise error
endSee the documentation for FileStore.Middleware for more information.