Base solution for your next web application
Open Closed

Exception Handling #644


User avatar
0
birthdaycensus created

I want to turn off the defaul error hanling of the ABP on the client side of my application. How do I do this since since the errors as been shown at times does not work well with my appliation


6 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    It's easy to change behaviour.

    If you are using Angularjs, Exception handling is done in abp.ng.js: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Resources/Abp/Framework/scripts/libs/angularjs/abp.ng.js#L19">https://github.com/aspnetboilerplate/as ... .ng.js#L19</a>

    You can override any method here. For example, if you only want to change how to show errors. You can write this in your javascript code (for example, in the app.js):

    abp.ng.http.showError = function(error){
        //TODO: Implement your own logic.
    }
    

    As similar, you can override whole result handling by overriding abp.ng.http.handleResponse. You can copy this method to your project and change inside.

    If you're using jQuery, it's similar for abp.jquery.js file (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Resources/Abp/Framework/scripts/libs/abp.jquery.js#L45">https://github.com/aspnetboilerplate/as ... ery.js#L45</a>). In this time, you can override like abp.ajax.showError = function (error) { ... };

    BUT.. I did not understand it exactly why you want to change it. I don't suggest it if you don't have a very good reason.

  • User Avatar
    0
    blenyo created

    This is the challange I am having currently. The site show error dailog every now and then. Some of the messages comes as null The site is an MPA I am using signalR to pass messages from the server to the client I also need to know user online at every point in time and so sends a HeartBeat from the client every 5 seconds. the address of the site is <a class="postlink" href="http://www.birthdaycensus.com">www.birthdaycensus.com</a>

    Please what do you suggest I do

    Thanks for your help

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Did you try to overriding abp.ajax.showError ? Also, are you sure that this is related to ABP erorr handling. Because ABP does not effect SignalR messaging. To be sure, override abp.ajax.showError and write some console.log to see it. I visited your web page but didn't see and error dialog yet.

  • User Avatar
    0
    hikalkan created
    Support Team

    As I see in your application, SetHearthBeat properly works.

    Note: You are using AngularJs, not jQuery.

  • User Avatar
    0
    blenyo created

    Thanks for your assistance I will try the overiding when I go back to work tommorow

  • User Avatar
    0
    blenyo created

    Solved Thanks. I was a connection problem on the client machine