I've got a plugin migration that returns false from its safeUp() method when certain conditions aren't met.

Upon returning false from the migration, the update stalls, rolls back changes and gives an error screen with a generic error message – i.e. "There was a problem updating your database".

For many users (i.e. those who aren't tech savvy enough to check logs etc.) this message isn't very helpful at all. Is it possible to add a custom message when a migration is aborted?

I've tried throwing an exception inside safeUp(), which gets logged but does not display on the error screen.

If I use a die() statement for the error message, Craft does display it on the error screen, but that makes the whole update process halt, which seems like an unsafe thing to do.

I've also attempted to use craft()->userSession->setError(), but that doesn't appear to be working, either.

  • 1
    Great idea! I'm gonna bet this one lands on "feature request" ;)
    – Lindsey D
    Jan 19, 2016 at 0:38

1 Answer 1


Currently not, but as Lindsey points out, that's not a bad idea for a feature request.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.