MDL-48889 repository_s3: pipe S3Exception messages into moodle
When processing S3Exceptions thrown by the S3 library, pass the exception messages into the moodle_exceptions being created in order to actually tell people what went wrong.
This commit is contained in:
+21
-3
@@ -101,7 +101,13 @@ class repository_s3 extends repository {
|
||||
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(
|
||||
@@ -120,7 +126,13 @@ class repository_s3 extends repository {
|
||||
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) {
|
||||
|
||||
@@ -195,7 +207,13 @@ class repository_s3 extends repository {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user