summaryrefslogtreecommitdiff
path: root/init.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-11-24 08:55:33 +0300
committerAndrew Dolgov <[email protected]>2022-11-24 08:55:33 +0300
commit80becb9afc3f2b651cc3574df344ded879cbf151 (patch)
tree460c92beae61e43be72222842d6a0fa82edc9960 /init.php
parent6041ced50b9be1f5af1177a92a0eb3a9206a36c5 (diff)
report aws exceptions
Diffstat (limited to 'init.php')
-rw-r--r--init.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/init.php b/init.php
index aa104b5..00e38e1 100644
--- a/init.php
+++ b/init.php
@@ -97,17 +97,23 @@ class Cache_S3 extends Plugin implements Cache_Adapter {
'Body' => $data
]);
} catch (AwsException $e) {
- //
+ user_error($e, E_USER_WARNING);
}
}
public function get(string $filename): ?string {
- $res = $this->s3->getObject([
- 'Bucket' => Config::get(self::CACHE_S3_BUCKET),
- 'Key' => $this->dir . '/' . $filename
- ]);
+ try {
+ $res = $this->s3->getObject([
+ 'Bucket' => Config::get(self::CACHE_S3_BUCKET),
+ 'Key' => $this->dir . '/' . $filename
+ ]);
+
+ return $res['Body']->__toString();
+ } catch (AwsException $e) {
+ user_error($e, E_USER_WARNING);
- return $res['Body']->__toString();
+ return null;
+ }
}
public function get_full_path(string $filename): string {