admin管理员组文章数量:1328770
Usin prisma in my project I have the problem that it ignore the try catch statement. I also saw a question like this here:
[Using a prisma query with callback seems to ignore try/catch blocks (Node)][1]
I do as suggested but it does not work. Here is a part of the code:
try {
await prisma.table.findMany({});
} catch (error) {
await LogService.crearErrorLog(error);
throw ClassToSendAnErrorWithPersonalization.internalServer('Some message');
}
I cant control the error, and ignore the trycatch. Some times i use the then() method to do something with the value in the sentence. But it's not generally in the app. I tried with the .catch() from the promise like this:
await prisma.table.findMany({}).catch( async (error) => {
await LogService.crearErrorLog(error);
throw ClassToSendAnErrorWithPersonalization.internalServer('Some message');
});
I tried with async and without async method to handle the error and don't work. Any suggestions? [1]: Using a prisma query with callback seems to ignore try/catch blocks (Node)
本文标签: error handlingPrisma ignore try catch statement and crash the serverStack Overflow
版权声明:本文标题:error handling - Prisma ignore try catch statement and crash the server - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742253867a2441263.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论