You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you shut down the server during a write you'll get an uncaught error. This comes up when using dynalite for testing. I'd expect it to swallow the error or emit it on the server object.
constdynalite=require('dynalite')constAWS=require('aws-sdk')/*Start a write to dyanlite and then shut down the server*/asyncfunctionrun(){constserver=dynalite({createTableMs: 0})server.on('error',(err)=>console.log(`Server Error ${err}`))awaitnewPromise(resolve=>server.listen(4567,resolve))console.log('dynalite started')constdynamo=newAWS.DynamoDB({endpoint: 'http://localhost:4567',region: 'US-EAST-1'})awaitdynamo.createTable({TableName: "Music",AttributeDefinitions: [{AttributeName: "Artist",AttributeType: "S"},{AttributeName: "SongTitle",AttributeType: "S"}],KeySchema: [{AttributeName: "Artist",KeyType: "HASH"},{AttributeName: "SongTitle",KeyType: "RANGE"}],ProvisionedThroughput: {ReadCapacityUnits: 5,WriteCapacityUnits: 5},}).promise()console.log('table created')constwritePromise=dynamo.putItem({TableName: "Music",Item: {"AlbumTitle": {S: "Somewhat Famous"},"Artist": {S: "No One You Know"},"SongTitle": {S: "Call Me Today"}},}).promise()server.on('connection',()=>{console.log('closing server')server.close()})writePromise.then(()=>console.log('write completed successfully'),()=>console.log('write errored as expected'))}run().catch(err=>console.log(`Run Error ${err}`))
This will error with
★ node dynalite-shutdown.js
dynalite started
table created
closing server
src/node_modules/dynalite/index.js:263
if (err) throw err
^
Error [ReadError]: Database is not open
at src/node_modules/levelup/lib/levelup.js:190:15
at src/node_modules/encoding-down/index.js:75:21
at processTicksAndRejections (internal/process/task_queues.js:81:21)
The text was updated successfully, but these errors were encountered:
It's probably this line that throws the non "statsCode" errors in the http handler. The handler is bound to null so it can't do a this.emit('error', error) instead of throwing. I notice there are a few other locations where there's uncaught throws too, so I'm guessing it was intentional.
Yeah, I think I had it there as a "look, we don't know what this error is, we assume it's bad, let's make sure we crash the process". Definitely overkill if there are known errors that can be dealt with
If you shut down the server during a write you'll get an uncaught error. This comes up when using dynalite for testing. I'd expect it to swallow the error or emit it on the server object.
This will error with
The text was updated successfully, but these errors were encountered: