Code Monkey home page Code Monkey logo

Comments (2)

dshafik avatar dshafik commented on June 14, 2024

Hi @cam8001,

This is great to see! I'd love to see better integration with Drupal 8 and will do what I can help you with that! :)

This issue seems very odd, as you can see on Line 446, there is a catch (\InvalidArgumentException) which should catch this exact exception.

What's happening is that the authentication handler needs to be added to the handler stack before the history handler if it has been added. Unfortunately, Guzzle provides no way to check if something is in the stack, so we attempt to add it before (Line 445), and if that fails this exception is thrown — we then just add it to the end of the stack (Line 448).

So yes, the exception is expected in some scenarios, and should be handled…

If I create a test case that replicates the pertinent bits of your code, as below, it passes just fine:

// Test class
class ClientExtended extends Client {
    public static function create($client_token, $client_secret, $access_token)
    {
        $config = ['timeout' => 5];
        $instance = new static($config);
        $instance->setAuth($client_token, $client_secret, $access_token);

        return $instance;
    }
}

// test case
public function testIssue19ExtendStaticInstantiate()
{
    $access_token = "akab-access-token-xxx-xxxxxxxxxxxxxxxx";
    $client_token = "akab-client-token-xxx-xxxxxxxxxxxxxxxx";
    $client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=";

    $instance = ClientExtended::create($client_token, $client_secret, $access_token);
    $this->assertInstanceOf(ClientExtended::class, $instance);
}

Can you confirm that you are using 0.4.2? Are you installing via Composer, or using the PHAR?

from akamaiopen-edgegrid-php-client.

cam8001 avatar cam8001 commented on June 14, 2024

Thanks for the excellent response!

As it turns out I had an over-enthusiastic XDebug config that was notified me about every Exception whether it was caught or not (xdebug.show_exception_trace=1).

Great to open the lines of communication though - I'm sure I'll call on you again ;).

from akamaiopen-edgegrid-php-client.

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.