HI. Currently I’m using
> throw RuntimeException("message");
Are there something more suitable?
My goal is to show a Notification if something goes wrong at onBeforeInsert and abort insert process
HI. Currently I’m using
> throw RuntimeException("message");
Are there something more suitable?
My goal is to show a Notification if something goes wrong at onBeforeInsert and abort insert process
Hi,
It is impossible to show notification directly from the middleware due to distributed architecture of the platform.
There is more convenient exception for your task: com.haulmont.cuba.core.global.validation.CustomValidationException
. For instance, It will be passed to REST-API clients as JSON object with message.
Also, you could introduce your own business exceptions and implement exception handlers for them: Client-Level Exception Handlers - CUBA Platform. Developer’s Manual
Thanks.
Actually, some minutes after post, I thought just the same thing. No sense to launch Dialogs from middlewar.