public function onComplete(CompleteEvent $event)
    {
        $code = (string) $event->getResponse()->getStatusCode();
        // Throw an exception for an unsuccessful response
        if ($code[0] === '4' || $code[0] === '5') {
            throw RequestException::create($event->getRequest(), $event->getResponse());
        }
    }
public function onComplete(CompleteEvent $event)
    {
        $code = (string) $event->getResponse()->getStatusCode();
        // Throw an exception for an unsuccessful response
        if ($code[0] === '4' || $code[0] === '5') {
            throw RequestException::create($event->getRequest(), $event->getResponse());
        }
    }
public function onComplete ( CompleteEvent $ event ) { $ code = ( string ) $ event -> getResponse ( ) -> getStatusCode ( ) ; // Throw an exception for an unsuccessful response if ( $ code [ 0 ] === '4' || $ code [ 0 ] === '5' ) { throw RequestException :: create ( $ event -> getRequest ( ) , $ event -> getResponse ( ) ) ; } }
Throw a RequestException on an HTTP protocol error

@param CompleteEvent $event Emitted event
@throws RequestException
Throw a RequestException on an HTTP protocol error