catch (TransferException
$e) { if (isset($stored['data'
])) { // Use the stale data to fall back gracefully, but warn site
// administrators that we used stale data.
$this->logger->
warning('Remote oEmbed providers could not be retrieved due to error: @error. Using previously stored data. This may contain out of date information.',
[ '@error' =>
$e->
getMessage(),
]);
return $stored['data'
];
} // We have no previous data and the request failed.
throw new ProviderException("Could not retrieve the oEmbed provider database from
$this->providersUrl", NULL,
$e);
} $providers = Json::
decode((string) $response->
getBody());
if (!
is_array($providers) ||
empty($providers)) { if (isset($stored['data'
])) { // Use the stale data to fall back gracefully, but as above, warn site
// administrators that we used stale data.
$this->logger->
warning('Remote oEmbed providers database returned invalid or empty list. Using previously stored data. This may contain out of date information.'
);
return $stored['data'
];
}