I use S3 php sdk and a liver implementation of this to put an object on S3.
try {
$s3->putObject(array(
'Bucket' => 'mybucket',
'Key' => 'abc',
'Body' => $img->encode(null, 90),
'ACL' => 'public-read',
'ContentType' => $img->mime()
));
}
catch (S3Exception $e) {
var_dump('error');
die();
}
But the code above does not seem to cause errors. I installed the wrong bucket and I still get the error:
type:Aws\S3\Exception\NoSuchBucketException, message:The specified bucket does not exist,โฆ
How can I catch this error and act on it accordingly.
source
share