Base solution for your next web application
Open Closed

abp.ajax error not showing UserFriendlyException messsage #1518


User avatar
0
korigoth created

Hey,

Can i get some help to understand why do i get this default error each time that I throw a UserFriendlyExceptionException in an MVC Controller with abp.ajax method.

i did a simple code to show the problem! (version 0.10.0.1)

public async Task<JsonResult> TestMethod()
{
            throw new UserFriendlyException("Test1", "Test2");
}

abp.ui.setBusy(
  $('#paneltest'),
  abp.ajax({
    url: abp.appPath + 'Home/TestMethod',
    type: 'POST',
    data: JSON.stringify({}),
    error: function (error, jqXHR) {
      console.log(error);
      console.log(jqXHR);
    }
  })
);

image to show the result of the Error in Browser : <a class="postlink" href="https://postimg.org/image/45edyyagl/">https://postimg.org/image/45edyyagl/</a>

sorry i didn't find a way to upload it here :(

So is there anything i'm doing wrong ?

EDIT:

I updated the project to 0.10.3.1 and the same problem happen.


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

    I created an issue to follow it: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1281">https://github.com/aspnetboilerplate/as ... ssues/1281</a> Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you try to set customErrors On in web config. While debugging the project, only customErrors="On" will show to error details in that dialog.

    <customErrors mode="On">
    

    For more information, please see <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Handling-Exceptions">http://aspnetboilerplate.com/Pages/Docu ... Exceptions</a>

  • User Avatar
    0
    korigoth created

    When putting this to On

    i get "Error detail not sent by server."

    What am i missing ?

    Edit :

    Ok i got it working... sorry i was using ActionResult as return type thx for the link to the doc! :)

    Is it a normal behaviour to return the real code in the abp.jquery.js -> handleResponse method

    data.error.responseText <- this property show my controller code like if it was the customError="Off"