diff --git a/repository/s3/lib.php b/repository/s3/lib.php index 8103d72cd483c..5d004a62b76ec 100644 --- a/repository/s3/lib.php +++ b/repository/s3/lib.php @@ -105,7 +105,13 @@ public function get_listing($path = '', $page = '') { try { $buckets = $this->s->listBuckets(); } catch (S3Exception $e) { - throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name()); + throw new moodle_exception( + 'errorwhilecommunicatingwith', + 'repository', + '', + $this->get_name(), + $e->getMessage() + ); } foreach ($buckets as $bucket) { $folder = array( @@ -124,7 +130,13 @@ public function get_listing($path = '', $page = '') { try { $contents = $this->s->getBucket($bucket, $uri, null, null, '/', true); } catch (S3Exception $e) { - throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name()); + throw new moodle_exception( + 'errorwhilecommunicatingwith', + 'repository', + '', + $this->get_name(), + $e->getMessage() + ); } foreach ($contents as $object) { @@ -199,7 +211,13 @@ public function get_file($filepath, $file = '') { try { $this->s->getObject($bucket, $uri, $path); } catch (S3Exception $e) { - throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name()); + throw new moodle_exception( + 'errorwhilecommunicatingwith', + 'repository', + '', + $this->get_name(), + $e->getMessage() + ); } return array('path' => $path); }