GithubHelp home page GithubHelp logo

Comments (1)

saintf avatar saintf commented on September 25, 2024 5

@hellboy81 can you try:

There's one part in the exception generator that I'm not terribly proud of:

  private Object resolveBody(Response response) {
    if (bodyType instanceof Class<?> && ((Class<?>) bodyType).isInstance(response)) {
      return response;
    }
    try {
      return bodyDecoder.decode(response, bodyType);
    } catch (IOException e) {
      // How do we log this?
      return null;
    } catch (DecodeException e) {
      // How do we log this?
      return null;
    }
  }

you see that it basically tries its best to decode the body, but if it fails, it actually does so silently (yuck).

That said - Feign itself doesn't decide on a logger for you... which begs the question: how to best log?

I expect that ErrorResponse is likely being returned in a format you don't expect or that your POJO doesn't fit to. You can perhaps debug by having the constructor just take feign.Response and capture the body/decode it yourself just to see what is happening.

The other option is a little more intrusive (Support some form of logging - while still not trying to be opinionated - much like what Feign itself tries to do). If you have a proposal (maybe we include a Logger class/object that logs the error, and if available, the body or so) then I'll be happy to implement it (or even, if you are up for it, have you implement it and I'll review).

Thoughts?

from feign-annotation-error-decoder.

Related Issues (18)

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.