From 80becb9afc3f2b651cc3574df344ded879cbf151 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 24 Nov 2022 08:55:33 +0300 Subject: report aws exceptions --- init.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'init.php') 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 { -- cgit v1.2.3