01-15-2020 07:28 AM
Hi,
i would like to throw some custom error in my Behaviour class when happens specific event over the node. Actually i use AlfrescoRuntimeExceptions with my message:
if(<event>) throw new AlfrescoRuntimeException("Custom Msg");
but Alfresco ignore this custom msg and build other to render it on the popup. Anyone knows how to build an custom error msg?
Thx in advance.
01-15-2020 10:44 AM
While the linked thread is relevant for any instances where custom failure messages have been configured in Share actions, it does not apply to errors thrown from Repository-tier behaviours. But I believe we have had multiple such threads on behaviours as well - the root issue here is the way Alfresco treats behaviours with notification frequency of TRANSACTION_COMMIT - those will always be handled by a transaction listener, which wraps any exceptions in an extremely generic message.
One such thread is https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-get-the-proper-exception-message-... - though this relates to a CMIS client, the core problem is the same. If you want this error message to show in Share, you need to use either EVERY_EVENT or FIRST_EVENT as notification frequency, or hope that Alfresco decides to suddenly change/fix this handling which has remained stable for ~10 years.
01-15-2020 08:33 AM
Hi @davidm,
This post might be helpful > https://hub.alfresco.com/t5/alfresco-content-services-forum/get-exception-on-action-java-class-and-o...
Kind regards,
01-15-2020 10:44 AM
While the linked thread is relevant for any instances where custom failure messages have been configured in Share actions, it does not apply to errors thrown from Repository-tier behaviours. But I believe we have had multiple such threads on behaviours as well - the root issue here is the way Alfresco treats behaviours with notification frequency of TRANSACTION_COMMIT - those will always be handled by a transaction listener, which wraps any exceptions in an extremely generic message.
One such thread is https://hub.alfresco.com/t5/alfresco-content-services-forum/how-to-get-the-proper-exception-message-... - though this relates to a CMIS client, the core problem is the same. If you want this error message to show in Share, you need to use either EVERY_EVENT or FIRST_EVENT as notification frequency, or hope that Alfresco decides to suddenly change/fix this handling which has remained stable for ~10 years.
01-16-2020 04:35 AM
Thanks Axel, with EVERY_EVENT stage works well and share shows my custom msg. It would be nice if @alfresco implemented this option at TRANSACTION_COMMIT too .
01-20-2020 06:18 AM
Hi @davidm,
Thanks for following up - this helps others in the community to know this works. Thanks also for you suggestion.
Kind regards,
Explore our Alfresco products with the links below. Use labels to filter content by product module.