AI OnAI Off
Can you catch the exception and look into it?
e.g
catch (EPiServerCancelException ex)
{
_logger.LogError(ex,
"Save cancelled. User={User}, Parent={Parent}, Type={Type}, Lang={Lang}", // or something like that
PrincipalInfo.CurrentPrincipal?.Identity?.Name,
targetParentRef?.ID,
sourcePage.ContentTypeID,
sourcePage.Language?.Name);
// debug from here
throw;
}
Also turn on Optimizely debug logging for content/events. That probably would be debug level on EPiServer, EPiServer.Core and EPiServer.DataAccess
This would be done in appsettings.json, e.g.
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Warning",
"EPiServer": "Debug",
"EPiServer.Core": "Debug",
"EPiServer.DataAccess": "Debug"
}
},
Can you run this in debug mode and look into the inner exception if any?
If debugging is not an option, your catch could try to see if ex.InnerException has anything
Hi everyone,
I’m working on a custom Optimizely CMS plugin/addon that programmatically creates a new page based on an existing source page and saves it using
IContentRepository.Save().We using the addon from our main project, the save fails with an exception:
Unfortunately, the reason is completely empty, which makes it very hard to diagnose what’s actually blocking the save.
Here’s a simplified version of the code:
My questions:
What typically causes an
EpiserverCancelExceptionwith an empty reason?Are there common CMS events, validators, or content handlers that silently cancel saves?
Is there a way to surface which validation or event handler is causing the cancellation?
Any known pitfalls when saving content from addons/plugins vs. site code?
Any pointers, debugging tips, or similar experiences would be hugely appreciated 🙏
Thanks in advance!
Thanks, Jakob