Reputation: 130
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)
Upvotes: 3
Views: 90