attain
attain copied to clipboard
How to handle global deno error?
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)=>{...})
try and catch them
try {
const db = await connect({});
} catch (error) {
console.log(error, "skip the connection")
}
const app = new App()
....
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.
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?
I tested with mongodb.
I guess it's a problem with the Mongo library then, postgres works fine.