javascript - An error keeps appearing when using koa mysql2
大家讲道理
大家讲道理 2017-06-12 09:20:20
0
2
864

I used the koa project generated by koa-generator. The routing part is written as follows:

router.get("/test",async (ctx, next) =>{

});

Mysql needs to be used. I chose the promise form of mysql2. Directly refer to the following link:

https://github.com/sidorares/...

But every once in a while, an error will be reported:

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1050:11)
    at TCP.onread (net.js:582:26)

I am here to ask about the reason for this error and how to solve it in this case. Thank you.

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
phpcn_u1582

No caught exceptions. Use

try ... catch ...
扔个三星炸死你

Add two ways to manually close the connection after an exception

connection.end(function(err) {
  // The connection is terminated now
});
--------------------

connection.destroy();
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template