dustin10 / VichUploaderBundle

A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
MIT License
1.83k stars 519 forks source link

If the underlying storage fails, emit an event #1450

Closed tarjei closed 3 months ago

tarjei commented 3 months ago

If the underlying storage fails, we emit an event that can be handled as the user wants.

The behaviour is to throw exceptions on write but not on remove as this seems to be the semantics as they are in the library prior to this change.

It seems to me that the error behavior of remove operations is a bit uneven. If a write fails in the native filesystem it seems to me that that will trigger some kind of error.

Anyhow, I think this keeps BC but introduces an event.

Ref #1449

tarjei commented 3 months ago

@garak thanks for a very quick review!

I'm still a bit unsure if an event is the correct approach. Maybe we could have a config option to either throw on failure or swallow it?

garak commented 3 months ago

PR is fine (already approved). Anyway, I meanwhile fixed the phpstan failure and would like to apply the check here. Please rebase/merge master

tarjei commented 3 months ago

@garak done! :) Oh the bliss of all green

garak commented 3 months ago

Thank you!