attain icon indicating copy to clipboard operation
attain copied to clipboard

How to handle global deno error?

Open devalexqt opened this issue 5 years ago • 5 comments
trafficstars

How to keep app running then connection to db was lost? For now deno process is just die.

//connect ot DB
var db=await connect(...)

const app = new App()
app.use((req,res)=>{...})

devalexqt avatar May 29 '20 12:05 devalexqt

try and catch them

try {
  const db = await connect({});
} catch (error) {
  console.log(error, "skip the connection")
}

const app = new App()
....

aaronwlee avatar May 29 '20 22:05 aaronwlee

Hi, I've tested the global Deno error issue. Here is a solution but this is not a perfect one. it just a temporary solution that automatically restarts the server after an uncaught error. I'll write a comment to the Deno repository about this issue and I hope they could fix it.

aaronwlee avatar May 31 '20 19:05 aaronwlee

I ran into a similar problem when playing around with Deno and MongoDB, and had the same issue. However working with a PostgreSQL in deno worked just fine. @devalexqt what database did you use?

itays123 avatar Aug 07 '20 09:08 itays123

I tested with mongodb.

devalexqt avatar Aug 07 '20 09:08 devalexqt

I guess it's a problem with the Mongo library then, postgres works fine.

itays123 avatar Aug 07 '20 11:08 itays123