@@ -110,10 +110,12 @@ public function discover(string $remote, bool $skipCache = false): ICapabilityAw
110110
111111 foreach ($ urls as $ url ) {
112112 $ body = null ;
113+ $ status = null ;
113114 try {
114115 $ response = $ client ->get ($ url , $ options );
115116 if ($ response ->getStatusCode () === Http::STATUS_OK ) {
116117 $ body = $ response ->getBody ();
118+ $ status = $ response ->getStatusCode ();
117119 // update provider with data returned by the request
118120 $ provider ->import (json_decode ($ body , true , 8 , JSON_THROW_ON_ERROR ) ?? []);
119121 $ this ->cache ->set ($ remote , $ body , 60 * 60 * 24 );
@@ -133,7 +135,7 @@ public function discover(string $remote, bool $skipCache = false): ICapabilityAw
133135 throw new OCMProviderException ('invalid remote ocm endpoint ' );
134136 } catch (JsonException |OCMProviderException ) {
135137 $ this ->cache ->set ($ remote , false , 5 * 60 );
136- throw new OCMProviderException ('data returned by remote seems invalid - status: ' . $ response -> getStatusCode ( ) . ' - ' . ($ body ?? '' ));
138+ throw new OCMProviderException ('data returned by remote seems invalid - status: ' . ( $ status ?? '' ) . ' - body: ' . ($ body ?? '' ));
137139 } catch (\Exception $ e ) {
138140 $ this ->cache ->set ($ remote , false , 5 * 60 );
139141 $ this ->logger ->warning ('error while discovering ocm provider ' , [
0 commit comments