composer-patches icon indicating copy to clipboard operation
composer-patches copied to clipboard

Throw exception if patch is not available

Open shochdoerfer opened this issue 3 years ago • 2 comments

When patch is not installed, the plugin will error with the generic "Cannot apply patch" error message. It took me quite a while today to figure out why things were running fine locally but not in our CI Docker image. Apparently, patch was not installed by default in the Debian Slim images.

It would be nice if the plugin could fail with a more precise error message when patch is not available.

shochdoerfer avatar Mar 10 '22 16:03 shochdoerfer

Please config as the doc says here https://github.com/cweagans/composer-patches#error-handling

skyred avatar Mar 18 '22 03:03 skyred

@skyred that's the configuration I use. But that does not solve the issue I raised. I would like to see a clearer error message when the patch tool was not found. "Cannot apply patch" is too generic to be useful. That sounds like the patch file can't be applied because the patch is wrong (whatever that means) but in my case, the patch tool was missing in the Docker container.

shochdoerfer avatar Mar 18 '22 07:03 shochdoerfer

Hello - I've run into this too and it took me a bit to find, what's wrong. One should expect that devs can came to a new project (like me) which do not have readme of this library, thus they don't know, what to expect/install (for example I expect things from composer "just works (tm)"). So yes, it would be nice to throw nice and loud exception with error message about missing patch tool.

marek-hanzal avatar Jan 17 '23 13:01 marek-hanzal

I've made a note to do this in #447

cweagans avatar Feb 06 '23 06:02 cweagans

@cweagans awesome! Thx!

shochdoerfer avatar Feb 06 '23 07:02 shochdoerfer