src/Guzzle/Plugin/Cache/CachePlugin.php
public function onRequestError(Event $event)
    {
        $request = $event['request'];

        if (!$this->canCache->canCacheRequest($request)) {
            return;
        }

        if ($response = $this->storage->fetch($request)) {
            $response->setHeader(
                'Age',
                time() - strtotime($response->getLastModified() ? : $response->getDate() ?: 'now')
            );

            if ($this->canResponseSatisfyFailedRequest($request, $response)) {
                $request->getParams()->set('cache.hit', 'error');
                $this->addResponseHeaders($request, $response);
                $event['response'] = $response;
                $event->stopPropagation();
            }
        }
    }
public function onRequestError(Event $event)
    {
        $request = $event['request'];

        if (!$this->canCache->canCacheRequest($request)) {
            return;
        }

        if ($response = $this->storage->fetch($request)) {
            $response->setHeader(
                'Age',
                time() - strtotime($response->getLastModified() ? : $response->getDate() ?: 'now')
            );

            if ($this->canResponseSatisfyFailedRequest($request, $response)) {
                $request->getParams()->set('cache.hit', 'error');
                $this->addResponseHeaders($request, $response);
                $event['response'] = $response;
                $event->stopPropagation();
            }
        }
    }
public function onRequestError ( Event $ event ) { $ request = $ event [ 'request' ] ; if ( ! $ this -> canCache -> canCacheRequest ( $ request ) ) { return ; } if ( $ response = $ this -> storage -> fetch ( $ request ) ) { $ response -> setHeader ( 'Age' , time ( ) - strtotime ( $ response -> getLastModified ( ) ? : $ response -> getDate ( ) ? : 'now' ) ) ; if ( $ this -> canResponseSatisfyFailedRequest ( $ request , $ response ) ) { $ request -> getParams ( ) -> set ( 'cache.hit' , 'error' ) ; $ this -> addResponseHeaders ( $ request , $ response ) ; $ event [ 'response' ] = $ response ; $ event -> stopPropagation ( ) ; } } }
If possible, return a cache response on an error

@param Event $event
If possible return a cache response on an error