mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
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:
parent
e0ae3519a1
commit
20a263ecfa
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user