Hey all, I’m kind of new to the async/await format...
# orm-help
p
Hey all, I’m kind of new to the async/await format, I’m just wondering why none of the prisma examples use try catch statements when using the prisma API. Is that bad practice? or does prisma take care of errors in a way that you don’t need try catch statements?
r
You should get a rejected promise. Which if rejected in another promise will cause a rejected promise higher up https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
r
In async/await, a rejected promise translates to a thrown exception, so yes, you should wrap your actual code in try/catch if using async/await
p
Oh ok, so a lot of tutorials out there are doing it wrong?
r
They're tutorials - not covering the case when something goes wrong.
p
ok thank you
just trying to build as close to a professional API as I can