Can I use $context to pass messages to the UI?

I am currently improving a user backend app. It has no UI but will use the new PSR-3 logger interface to log errors and add exceptions to the $context.

If one of its operations fails, Nextcloud’s user admin interface shows a generic message like this:

What would be the easiest way to overwrite the message An error occurred during the request… and show the actual cause? Can this be done with $context?