OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

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 6 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #25466

    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
  • #25467

    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.

    #25468

    ykasenka
    Participant

    Example
    controller:

    twig:

    #25469

    ykasenka
    Participant

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

    #25470

    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.

    #25471

    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:

    #25472

    ykasenka
    Participant

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

    #25473

    zhex900
    Participant

    Yes. Thank you!

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

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top