Using RAISE EXCEPTION (PostgreSQL)

I have a problem with showing the messages from the Database, previously, in the 2018 and 2020 versions I could do this: RAISE EXCEPTION ‘CUSTOM ERROR FROM DATABASE’, appeared or a modal or an alert with that message. But when migrating to version 2022, only an Error message appears… Does anyone know how to show those error messages in version 2022?

Raising an error on the server side does not raise an alert on the client side, it will trigger the error handler and the error will be shown in the error page. If you have not enabled the advanced setting “Treat PHP warnings and notices as errors”, you may try to raise exception at the warning or notice level only so the error handler will not be triggered (assume the PHP postgreSQL driver will trigger warning/notice in PHP accordingly).