Error custom messages throwing Exception

cancel
Showing results for 
Search instead for 
Did you mean: 
davidm
Active Member II

Error custom messages throwing Exception

Jump to solution

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?

 

Captura.JPG

 

 

Thx in advance.

1 Solution

Accepted Solutions
afaust
Master

Re: Error custom messages throwing Exception

Jump to solution

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.

View solution in original post

4 Replies
Community Manager
Community Manager

Re: Error custom messages throwing Exception

Jump to solution

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, 

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!
afaust
Master

Re: Error custom messages throwing Exception

Jump to solution

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.

View solution in original post

davidm
Active Member II

Re: Error custom messages throwing Exception

Jump to solution

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 Smiley Wink.

 

 

Community Manager
Community Manager

Re: Error custom messages throwing Exception

Jump to solution

Hi @davidm,

Thanks for following up - this helps others in the community to know this works. Thanks also for you suggestion.

Kind regards, 

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!