php - Catching an error with put object and s3 -
i'm using s3 php sdk , larval implementation of set object on s3.
try { $s3->putobject(array( 'bucket' => 'mybucket', 'key' => 'abc', 'body' => $img->encode(null, 90), 'acl' => 'public-read', 'contenttype' => $img->mime() )); } grab (s3exception $e) { var_dump('error'); die(); } but above code not seem grab errors. set wrong bucket , still error:
type:aws\s3\exception\nosuchbucketexception, message:the specified bucket not exist,… how can grab error , deed on accordingly.
use right parent class
to grab s3 exceptions - create sure refer right namespace:
catch (\aws\s3\exception\s3exception $e) { or
<?php utilize aws\s3\exception\s3exception; ... grab (s3exception $e) { otherwise, grab block not capture exceptions thrown s3 library.
php amazon-web-services amazon-s3 laravel-4
No comments:
Post a Comment