Hi,
Is there any way to prevent save action to complete except from using action-valid? It seems that any exception thrown in an action-method, even if returned through response.error (using TraceBackService) is ignored and entity is saved anyway.
Regards
Hi,
Is ‘save’ action there after ‘action-method’ ?. If yes, remove it and directly save the record in action-method. Use response.setReload to reload the record.
Hi,
In fact, it seems that exception in controller defaults to a flash if simply traced: https://github.com/axelor/axelor-business-suite/blob/master/axelor-exception/src/main/java/com/axelor/exception/service/TraceBackService.java#L214 adding the error responseType does the trick
Regards
Hi @beuss,
Could u please just give more explanation. To avoid save when form has “onSave=myaction, save” what do we need to do in the controller: response.setError(error) or TraceBackService.trace(); I guess the first one but I just want to be shure
Thanks in advance
If you don’t trace the error then response.setError
will do it, otherwise, you can add a ResponseMessageType.ERROR
to the TraceBack.trace
call who will take care of calling setError and will log the error.
Great, thank you.