@prisma/client#PrismaClientKnownRequestError TypeScript Examples

The following examples show how to use @prisma/client#PrismaClientKnownRequestError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts    From next-crud with MIT License 6 votes vote down vote up
handleError(err: Error) {
    console.error(err.message)
    if (
      err instanceof PrismaClientKnownRequestError ||
      err instanceof PrismaClientValidationError
    ) {
      throw new HttpError(
        400,
        'invalid request, check your server logs for more info'
      )
    } else {
      throw new HttpError(
        500,
        'an unknown error occured, check your server logs for more info'
      )
    }
  }