Custom preprocessor exception message not shown in the page | Community
Skip to main content
Level 2
January 3, 2020
Solved

Custom preprocessor exception message not shown in the page

  • January 3, 2020
  • 3 replies
  • 5297 views

Hi, 

We have written a custom preprocessor that gets invoked on page publish to identify if a particular component is present on the page and invoke a workflow for approval before page activation. This all works fine but the custom 'ReplicationException' is not showing up in the page. It shows up in the sites/siteadmin section when i click on "quick publish" button, but the exception is not showing up in the actual page when i click on "Publish Page". In the actual page, it only says "ERROR: Failed to publish the selected page(s)"

 

I am on AEM 6.4.6.0, any idea why this behavior?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Dipti_Chauhan

Hi,

When you throw error message from processor e.g

 

throw new ReplicationException("your custom message");  This message only gets priority when you publish page from siteadmin.

 

If you want to show different error message when you publish from page then you need to overlay : http://localhost:4502/libs/cq/gui/components/authoring/editors/clientlibs/core.js    <Check quick publish option>.

 

Thanks

Dipti

 

 

3 replies

joerghoh
Adobe Employee
Adobe Employee
January 4, 2020

Is it documented that the exception message is displayed in the error message to the authors?

Level 2
January 5, 2020

I am not sure if this is documented anywhere but i was looking into this file /libs/cq/gui/components/common/wcm/clientlibs/wcm/js/publish.js that has the necessary logic in fail/error condition. This is very similar change to quickpublish.js or managepublication.js that were being discussed in the other thread. I tried to overlay it but still no luck

joerghoh
Adobe Employee
Adobe Employee
January 5, 2020
Does the servlet then return the proper message at all, so it will be picked up by the JS?
Dipti_Chauhan
Community Advisor
Dipti_ChauhanCommunity AdvisorAccepted solution
Community Advisor
January 6, 2020

Hi,

When you throw error message from processor e.g

 

throw new ReplicationException("your custom message");  This message only gets priority when you publish page from siteadmin.

 

If you want to show different error message when you publish from page then you need to overlay : http://localhost:4502/libs/cq/gui/components/authoring/editors/clientlibs/core.js    <Check quick publish option>.

 

Thanks

Dipti

 

 

Level 2
January 6, 2020

You mean to say this one /libs/cq/gui/components/authoring/editors/clientlibs/core/js/actions/publish.js?

 

Will check it out, thanks!