ssossossossosso

Forums

Forums OroCRM OroCRM – Programming Questions Create Custom Widget Error Message

This topic contains 7 replies, has 2 voices, and was last updated by  zhex900 4 months, 4 weeks ago.

  • Creator
    Topic
  • #22862

    zhex900
    Participant

    Hi,

    How do I create a custom widget error message?
    Screen_Shot_2017_08_10_at_12_33_28_pm
    I want to change this error message to something more meaningful.

    This is what I have now. But error message is only displayed after I refresh the page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #22863

    ykasenka
    Participant

    Hello

    By default, it is no possible to customize error message when server returns 500 code. Please wrap you code by try-catch and pass error message to your widget template.

    #22865

    ykasenka
    Participant

    Example
    controller:

    twig:

    • This reply was modified 5 months ago by  ykasenka.
    • This reply was modified 1 month, 2 weeks ago by  Mike Luskavets.
    #22867

    ykasenka
    Participant

    @zhex900, did you get an answer to your question?

    #22868

    zhex900
    Participant

    I want to throw the exception other places not just in the controller. For example EventListeners, Managers. Where do I add the twig you suggested? Basically, I want to have a way to display error messages.

    #22869

    ykasenka
    Participant

    For wrap exceptions for dialogs globally, you need create and register exception listener, like that:

    create you widget (extended from “oro/dialog-widget”), overwrite current logic, and register it instead of “oro/dialog-widget” on you bundle (see method _onContentLoadFail), like that:

    #22870

    ykasenka
    Participant

    @zhex900, this time did you get an answer to your question?

    #22871

    zhex900
    Participant

    Yes. Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.