wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
72 stars 15 forks source link

Make Runner:run() more verbose in case of failure #218

Open ocean90 opened 3 years ago

ocean90 commented 3 years ago

Issue Overview

❯ wp @translate traduttore project update 239
Warning: Could not update translations for project (ID: 239)!

It would be nice to display why exactly the translations could not be updated. The command uses Runner:run() which unfortunately only returns "True on success, false otherwise.". In my case it was a stale lock so I was expecting that the warning would mention that.

I think Runner:run() should be updated to return a WP_Error object or throw an exception in case of failures.

swissspidy commented 3 years ago

It's also impossible to tell whether the update failed at the POT generation or at the import stage in Updater::update().

Throwing exceptions throughout the codebase for failures like this, which could then be caught in ProjectCommand or earlier, would make this easier for sure.