5

I would like to throw a custom error to stop a component from publishing. In Tridion 5.3 the following was working:

throw new Exception("This is a custom error message");

In Tridion 2011, the component does fail, but in the Publish Transaction window I see only the following message:

"The number of render failures has exceeded its specified failure limit of 0."

3 Answers 3

4

I tried the following which is working:

throw new Tridion.ContentManager.Publishing.PublisherException(
    new Tridion.Localization.LocalizableMessage(
        Properties.Resources.ResourceManager, 
        "ComponentPublishError"
    )
);

The simple throw new Exception("custom error") is really not showing any information in the Transaction Details.

3

The same should be working in Tridion 2011. The behaviour you're explaining could be due to an exception caused by some other place in your code. Run your template in Template Builder to see the exact line number of the exception to verify.

1

Would you like to see this question I have raised in the forum with the process defined for it and possible limitation that we are not able to overcome:

Custom Message

Please note, in 2011, the Publishing process happens up in one transaction, and note that you need to throw StorageException explicitly instead of the Exception. So you should be doing something like as below:

throw new StorageException(<Custom Error Message>);

instead of:

throw new Exception("This is a custom error message");

I hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.