Scenario: (In SDL Tridion 2011 SP1 HR1)
We have a storage extension which indexes the Component Presentation in SOLR, now If due to some reason this indexing is failed, we want to rollback the publishing and emit a Failure status to CME GUI with a Custom message.
What we have achieved so far and what is the issue:
We are able to rollback and emit the failure to GUI successfully. We sent the custom message as well but it get displayed twice on the CME GUI along with some default message from Tridion.
What we need:
We want to show only non-redundant custom message that we sent through storage extension. Is it possible to control this behaviour and is it possible to show a specific custom message on rollback and failure through storage extension. Did any one in the group come across any out of the box or tailor made solution.
Per Bart's suggestion Below is the code I am using for sending back the custom messages in the Storage Extension written for Dynamic Component Presentation:
public void create(ComponentPresentation itemToCreate, ComponentPresentationTypeEnum componentPresentationType)
throws StorageException
{
try
{
.. Code for Indexing the Data in SOLR and capturing any error..
if(<Indexing is successful>) {do nothing}
else
{
throw new StorageException(<Custom Error Message>);
}
}
catch(Exception ex)
{
throw new StorageException(<Custom Error Message>);
}
}
else
or thecatch
clause?