Comments (7)
Hello,
As you pointed out 404 response is expected when a DELETE request is performed on an object that doesn't exist. I'd suggest you wrap the delete call with a try/catch block.
The unit test expects the delete operation to be successful. I wanted the test to fail if the delete operation is not successful. Sorry about the confusion though.
Cheers!
from softlayer-object-storage-php.
Thanks for getting back to me and for the confirmation. I went ahead and wrapped the delete call, along with all other calls to ObjectStorage, inside a try/catch block. This way it won't cause a fatal error within my web application. One last question. Once I've caught the 404, or whatever the exception might be, is there a way to get the status code that was received? Something like $e->getStatusCode() where $e is an Exception object?
from softlayer-object-storage-php.
I think the ability to get the HTTP code from an exception is a great idea. I will implement the exception code for all HTTP exception sub classes so you can use $e->getCode(). Also, I will update all ObjectStorage_Exception_Http_* classes to implement ObjectStorage_Exception_Http_Interface so you can expect the HTTP status code when you're catching these exceptions.
from softlayer-object-storage-php.
Wow! That would be very helpful. Thanks! I'll look forward to the update.
from softlayer-object-storage-php.
HTTP exceptions will have the status code now.
Cheers!
from softlayer-object-storage-php.
Probably needs docs in the README
from softlayer-object-storage-php.
Going ahead and closing this since it looks like it was resolved with c65981b. Thanks!
from softlayer-object-storage-php.
Related Issues (19)
- Client.php HOT 2
- Add tests to Travis-CI
- Bug for mime types not in $mimeTypes array
- Please remove empty autoload line in composer.json HOT 1
- Readme.markdown HOT 1
- Support for TLSv1? HOT 2
- Versioning HOT 2
- Proper user-agent
- Progress of Uploading?
- Upload file larger then 5GB?
- Initialization error exception
- Support for arbitrary CURL options, or at least for connect timeout option HOT 1
- Traversing prefixed container to get all objects, but getObjectCount() returns number of all objects in the container without prefix
- Socket.php SSL3_WRITE_PENDING:bad write retry on Create() HOT 1
- Get Modified date
- Integration with Bluemix HOT 1
- Issue on search container
- This doesn't work in conjunction with other frameworks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from softlayer-object-storage-php.