Base solution for your next web application
Open Closed

How to throw and handle view/partial view errors? #5674


User avatar
0
davidharrison created

Hi Guys,

If you are loading a view or a partial view, how do you correctly throw an error (for example if a permission check has been run to verify user is authorized to view view) and then handle the thrown error?

We've tried working with UserFriendlyException but as far as we can ascertain, there is a mismatch between the return types and error handling types. If our understanding is correct, when requesting a view, the request is expecting an html view/error view to return, but the UserFriendlyException returns a json format error?

Thanks


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    @davidharrison are you trying to open a modal or is it a partial view on a page ? If it is a modal, ModalManager should handle it and show a proper error message.

  • User Avatar
    0
    davidharrison created

    Hi @ismcagdas,

    Yes we are trying to open a modal.

    What type of exceptions can the ModalManager handle? a UserFriendlyException or another type?

    Thanks,

    David

  • User Avatar
    0
    ryancyq created
    Support Team

    you can refer to how modal manager handles error when loading the view at here

  • User Avatar
    0
    alper created
    Support Team

    closed due to inactivity.