ContentService.Published - Throw Error Bubble or Show Error Message
Hello,
I have a custom event which is being called on ContentService.Published (when saving and publishing a document) which is shown below.
This custom event makes a call out to an api but if for whatever reason there is an issue an exception is thrown. I want to be able to handle this exception gracefully, either throught the little notification bubble in the bottom right or if possible show an error at the top of the page after saving and publising a document.
I thought what I had below would work but the bubble isn't showing - i have a feeling it is being overriden by the "Content Published - visible on front end" bubble which is coming up.
Any ideas anyone?
Thanks in advance
Kenny
private static void ContentService_Published(IPublishingStrategy sender, PublishEventArgs<IContent> e) { try { //CALL TO API / DO STUFF } catch (Exception ex) { var clientTool = new Umbraco.Web.UI.Pages.ClientTools((System.Web.UI.Page)HttpContext.Current.CurrentHandler); clientTool.ShowSpeechBubble(SpeechBubbleIcon.Error, "EVENTBRITE ERROR", ex.Message); } }
I'm not sure that would work as its supposed to be created on the page in use and uses the object (I guess) get create the relevant js. Creating your object won't be read by the basepage, a quick google foo shows this related item herehttp://stackoverflow.com/questions/14255753/how-to-stop-umbraco-from-displaying-speech-bubble
"During this demo someone asked if it's possible to show a custom message in the speechbubble event when an event is canceled. This is not possible (tested it this morning), I've created an item on CodePlex."
ContentService.Published - Throw Error Bubble or Show Error Message
Hello,
I have a custom event which is being called on ContentService.Published (when saving and publishing a document) which is shown below.
This custom event makes a call out to an api but if for whatever reason there is an issue an exception is thrown. I want to be able to handle this exception gracefully, either throught the little notification bubble in the bottom right or if possible show an error at the top of the page after saving and publising a document.
I thought what I had below would work but the bubble isn't showing - i have a feeling it is being overriden by the "Content Published - visible on front end" bubble which is coming up.
Any ideas anyone?
Thanks in advance
Kenny
I'm not sure that would work as its supposed to be created on the page in use and uses the object (I guess) get create the relevant js. Creating your object won't be read by the basepage, a quick google foo shows this related item herehttp://stackoverflow.com/questions/14255753/how-to-stop-umbraco-from-displaying-speech-bubble
maybe try something along the lines of
void ContentService_Published(IPublishingStrategy sender, PublishEventArgse)
{
((BasePage)HttpContext.Current.Handler).ClientTools.ShowSpeechBubble(SpeechBubbleIcon.Error, "Error", "Problem");
}
if this doesnt work (I havnt tested it)
try to replace HttpContext.Current.Handler with one of the other values HttpContext.Current.CurrentHandler,
edit: further google foo from the soeteman monster, http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx says
"During this demo someone asked if it's possible to show a custom message in the speechbubble event when an event is canceled. This is not possible (tested it this morning), I've created an item on CodePlex."
Thanks Stephen.
Yeah i think it looks more like the first link you mention (http://stackoverflow.com/questions/14255753/how-to-stop-umbraco-from-displaying-speech-bubble) where my custom speech bubble is being overriden by an umbraco one.
I guess I will keep trying - got to be a way!
Keny
Hi Kenny,
Did you get a solution?
Martin
is working on a reply...