From 14bad68d70f98daa810a616d82e5168929fe3e3c Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 9 Sep 2020 14:48:19 +0200 Subject: [PATCH] HFP-3095 Throw error if retrieving content from hub failed --- h5p.classes.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/h5p.classes.php b/h5p.classes.php index c5a16e9..1833b71 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -3739,6 +3739,10 @@ class H5PCore { throw new Exception($this->h5pF->t('Unable to authorize with the H5P Hub. Please check your Hub registration and connection.')); } + if (isset($response['status']) && $response['status'] !== 200) { + throw new Exception($this->h5pF->t('Connecting to the content hub failed, please try again later.')); + } + $hub_content = json_decode($response['data'])->data; $hub_content->id = "$hub_content->id"; return $hub_content;