ca98am79 / connect-dynamodb

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

Block when creating table #46

Open cjhowedev opened 7 years ago

cjhowedev commented 7 years ago

When connect-dynamodb creates the table for the first time, it logs the result of the request out to console.log. Is this correct behavior? Doesn't it need to block somehow until the creation of the table is complete? I understand this would require some work on the API, but it also seems like a race condition on whether the table gets created before connect-dynamodb uses it.

https://github.com/ca98am79/connect-dynamodb/blob/master/lib/connect-dynamodb.js#L69-L89

Digitum commented 3 years ago

Since this is not yet handled, I contribute with some more improvment suggestions. Add options errorHandler that takes a function with two arguments, one error code (like DynamoDBResourceInUseException or DynamoDBAccessDeniedException) and second argument with the error object. Default error handler just send the error as now, to the console.

Or something like that.

lancegliser commented 1 year ago

This is implemented in #76. Initialization was moved to the methods, instead of the constructor so thrown errors prevent usage.