Giter Site home page Giter Site logo

Comments (7)

dmlittle avatar dmlittle commented on June 8, 2024 1

@aarondfrancis I haven't been able to reproduce this error nor find anything in our logs that would indicate there's an issue with our API or wrapper regarding this issue.

I'll be closing this issue now but feel free to comment on this issue or message [email protected] if you see this problem again.

from lob-php.

aarondfrancis avatar aarondfrancis commented on June 8, 2024

I believe Guzzle has a hasResponse method on the exception object.

http://docs.guzzlephp.org/en/stable/quickstart.html?highlight=exceptions#exceptions

from lob-php.

dmlittle avatar dmlittle commented on June 8, 2024

@aarondfrancis do you happen to have an example payload that triggers or has triggered the exception? What method were you using?

from lob-php.

dmlittle avatar dmlittle commented on June 8, 2024

Also, what version of the wrapper are you currently using?

from lob-php.

aarondfrancis avatar aarondfrancis commented on June 8, 2024

From my composer.lock:

"name": "lob/lob-php",
"version": "v2.1.1",
"source": {
    "type": "git",
    "url": "https://github.com/lob/lob-php.git",
    "reference": "f74c6a75cac247691762580fccce8cbe264c4b37"
},

Not sure what the payload is, but if I see another one I'll grab it and post back!

from lob-php.

aarondfrancis avatar aarondfrancis commented on June 8, 2024

It seems like you shouldn't call getBody on a getResponse knowing that getResponse can sometimes return null.

Even if it's a network issue, I believe the library should handle that gracefully.

Why not call hasResponse before trying to call getBody?

from lob-php.

aarondfrancis avatar aarondfrancis commented on June 8, 2024

Please check out this SO post: https://stackoverflow.com/a/40644585.

While the answers above are good they will not deal with network errors ...

It's better in this case to expect RequestException and check for a response.

If there are network errors, we need to ensure the application doesn't crash

from lob-php.

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.