Giter Site home page Giter Site logo

Comments (9)

josephwoodward avatar josephwoodward commented on May 20, 2024 2

Sorry it's taken me so long to get around to fixing this, however it's now been fixed in 4.0.1 which can be found on NuGet here. Decided to hold off on the above solution and instead just moved setting the status code before the log delegate is invoked. I'll close this issue now but please do let me know if there are any problems! 😄

from globalexceptionhandlerdotnet.

josephwoodward avatar josephwoodward commented on May 20, 2024 1

@dharanish @codecontemplator So it does! My test tests against a 500 which is why it was passing, I'll get that fixed.

from globalexceptionhandlerdotnet.

josephwoodward avatar josephwoodward commented on May 20, 2024

Hi @codecontemplator, thanks for raising this.

You can access the mapped status code via the httpContext argument (httpcontext.Response.StatusCode).

Is this what you were looking for or have I misunderstood your question?

Thanks,
Joe

from globalexceptionhandlerdotnet.

dharanish avatar dharanish commented on May 20, 2024

Hi, @josephwoodward thanks for your reply.

when I try to access httpContext.Response.StatusCode it always gives me 500 internal server error.

Could you please tell me if I am missing something.

from globalexceptionhandlerdotnet.

codecontemplator avatar codecontemplator commented on May 20, 2024

I experience the same thing. It seems like the OnError (logger) is invoked before the status code is resolved.

https://github.com/JosephWoodward/GlobalExceptionHandlerDotNet/blob/master/src/GlobalExceptionHandler/WebApi/ExceptionHandlerConfiguration.cs

from globalexceptionhandlerdotnet.

dharanish avatar dharanish commented on May 20, 2024

yeah @codecontemplator, I think _logger can be invoked after resolving status code.

from globalexceptionhandlerdotnet.

codecontemplator avatar codecontemplator commented on May 20, 2024

Thanks!

from globalexceptionhandlerdotnet.

dharanish avatar dharanish commented on May 20, 2024

Is it possible to provide any update on this issue.?

from globalexceptionhandlerdotnet.

josephwoodward avatar josephwoodward commented on May 20, 2024

@dharanish Yeah, working on a solution - hoping to get it out in the next few days. Ultimately I've created an overload that gives you some different options then I'll retire the older one ((Exception, HttpContext)) in the next major version release.

from globalexceptionhandlerdotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.