Skip to content
Discussion options

You must be logged in to vote

Hey @dshunfen, I'm glad to know you are doing a more advanced usage of our library!

I took the opportunity to edit your comment and add syntax highlight to it, for better readability. (by adding ts after the triple quotes: ```ts)

I'm not very found of Prisma, but my line of though goes like:

// I'd create a function to wrap the given function in a transation
async function wrapInTransaction<T>(fn: T): T {
  return (...args: Parameters<T>) => await prisma.$transaction(async () => fn(...args))
}
// The error mapper you mentioned
function errorMapper(errors: Error[]): Error[] {
  errors.map((error) => {
    // ... <map error logic here>...
  }
  return [new Error('Internal server error. Pl…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gustavoguichard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants