Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bandico0t 11 posts 48 karma points
    Jan 24, 2014 @ 08:37
    Bandico0t
    0

    Custom EventHandlers, how to set error message

    Hello guys. First, excuse my english.

    I need to control moving to trash some nodes by alias. I have created my custom EventHandler for "Document.BeforeMoveToTrash" event. I can set Cancel flag to true, for preventing this action.

    Is there any way to set error message in event handlers and show it in backend infobubble? I want to show error with some additional error details.

    Regards, Anton

    P.S.: Error bubble in my understanding is

    enter image description here

  • Gordon Saxby 1461 posts 1883 karma points
    Jan 28, 2014 @ 10:05
    Gordon Saxby
    0

    I would also like to know if this is possible!

  • Gordon Saxby 1461 posts 1883 karma points
    Jan 28, 2014 @ 11:06
    Gordon Saxby
    0

    I saw mention of this in another post (which I can't find again), to get your own message in the bubble, raise an exception:

    throw new Exception("Your message here");
    

    This on its own appears to cancel the event (testing "Trashing" on MediaService), but I guess setting e.Cancel = true is advisable too?!

  • Bandico0t 11 posts 48 karma points
    Jan 28, 2014 @ 11:14
    Bandico0t
    0

    Hello Gordon. I found this solution, but it not work perfectly.

    If I throw an exception in the event BeforeUnpublish, Umbraco falls (YSOD screen).

Please Sign in or register to post replies

Write your reply to:

Draft