ca98am79 / connect-dynamodb

DynamoDB session store for Connect
http://ca98am79.github.com/connect-dynamodb/
MIT License
144 stars 66 forks source link

Dev catching dynamodb errors bugfix #12

Closed kristian-ackar closed 11 years ago

kristian-ackar commented 11 years ago

Hi,

I experienced troubles when using connect-dynamodb module for sessions handling when get method is invoked on table which have exceeded provisioned throughput.

I noticed that you use try/catch block for catching any kind of errors, but catch block will only catch exceptions, not all kind of errors.

You can notice that you try to read Item property of result object which is in some circumstances null value. So, "cannot read property Item of null" error occurred which returns error code 500: internal server error.

I added code that will first check is error variable set. If it is then pass it to the callback function fn. If err variable is not set then do try/catch block.

Please review this code and merge it on the master branch ASAP because we have this module in production.

Also it will be very good to check other similar "might be problems".

Best regards

ca98am79 commented 11 years ago

thanks, I've merged this in and repackaged