Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

how to get detailed error from web api #5152


User avatar
0
velu created

Hi,

We are using aspnetCore 1.* angular4 (Combined solution).

We are fetching data in android APK using aspnetzero WebApi.

Sometimes it returns a null message or html page.

We want to get detailed error via web api

Can you please help me in this

Thanks.


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

    hi,

    If you are using WebRequestExecuter class to retrieve data from application services then remove the_Debugger.IsAttached_ checks to see error details.

    Original:

    if (Debugger.IsAttached)
    {
         httpExceptionMessage += Environment.NewLine + httpException.Message;
    }
    

    Updated:

    httpExceptionMessage += Environment.NewLine + httpException.Message;
    

    remove all repeating Debugger.IsAttached if conditions

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @velu,

    It could be related to your server side code. Could you share a server side method and it's result ?

  • User Avatar
    0
    velu created

    Hi,

    Where we can apply this code.

    In aspnet zero application or webapi or android.

    We cannot find the Debugger.IsAttached in our solution.

    Please help me on this.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/master/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Mobile.Shared/Core/Threading/WebRequestExecuter.cs#L234">https://github.com/aspnetzero/aspnet-ze ... er.cs#L234</a>.

    But are you using the Xamarin app provided by AspNet Zero or not ?

  • User Avatar
    0
    velu created

    Hi,

    We are accessing web api in an android studio for the android app (apk)

    Thanks.

  • User Avatar
    0
    alper created
    Support Team

    In that case, you can send all exception details to the Android client by enabling the below config. In the project *.Web.Host > Startup > *WebHostModule.cs (where * refers to your CompanyName.ProjectName)

    Add the following config;

    Configuration.Modules.AbpWebCommon().SendAllExceptionsToClients = true;
    

    [attachment=0:2fa25py4]SendAllExceptions.jpg[/attachment:2fa25py4]

    Related links:

    • #382@8d092d2a-322b-4dbb-9391-9a625779d7e1
    • #4460
    • <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Startup-Configuration?searchKey=SendAllExceptionsToClients">https://aspnetboilerplate.com/Pages/Doc ... sToClients</a>
    • <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Handling-Exceptions">https://aspnetboilerplate.com/Pages/Doc ... Exceptions</a>
    • <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/59">https://github.com/aspnetboilerplate/as ... /issues/59</a>
    • <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/270">https://github.com/aspnetboilerplate/as ... issues/270</a>

    Have a nice day ;)