New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure oneClickUpdatePartTwo always returns json #15877
Conversation
$messages = array_merge($messages, $response); | ||
if (!empty($response)) { | ||
$messages = array_merge($messages, $response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case there is an exception, should we throw an UpdaterException? Eg, we could in oneClickUpdatePartTwo()
return {"error": true, "messages": [...]}
and throw the exception as it would have been before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to add a quick test for this too, like a unit test for the controller that uses a mock updater. Not sure if it's worth the effort though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about returning an error and throwing an exception in that case. But actually when updating the plugin fails and some plugin would be incompatible then, they would be disabled afterwards. Not sure if we should report that as failed update 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, maybe not
That actually solves the issue and should show the exception message in the updater log.
Or should we throw an exception if
oneClickUpdatePartTwo
didn't work?fixes #15876