diff options
author | Andrew Dolgov <[email protected]> | 2022-11-24 08:55:33 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-11-24 08:55:33 +0300 |
commit | 80becb9afc3f2b651cc3574df344ded879cbf151 (patch) | |
tree | 460c92beae61e43be72222842d6a0fa82edc9960 /init.php | |
parent | 6041ced50b9be1f5af1177a92a0eb3a9206a36c5 (diff) |
report aws exceptions
Diffstat (limited to 'init.php')
-rw-r--r-- | init.php | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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 { |