{"id":19580500,"url":"https://github.com/vinpac/prisma-error-enum","last_synced_at":"2025-04-27T08:32:18.780Z","repository":{"id":46974148,"uuid":"338902115","full_name":"vinpac/prisma-error-enum","owner":"vinpac","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-03T16:22:05.000Z","size":181,"stargazers_count":31,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T23:31:58.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinpac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-14T21:07:04.000Z","updated_at":"2024-03-11T21:52:38.000Z","dependencies_parsed_at":"2024-11-11T07:28:56.146Z","dependency_job_id":"e33ab912-36ae-4211-aeb4-6bd6aeb6c89c","html_url":"https://github.com/vinpac/prisma-error-enum","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinpac%2Fprisma-error-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinpac%2Fprisma-error-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinpac%2Fprisma-error-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinpac%2Fprisma-error-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinpac","download_url":"https://codeload.github.com/vinpac/prisma-error-enum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251112549,"owners_count":21538162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T07:26:57.815Z","updated_at":"2025-04-27T08:32:18.308Z","avatar_url":"https://github.com/vinpac.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Deploy](https://github.com/vinpac/prisma-error-enum/workflows/Deploy/badge.svg)\n[![npm version](https://badge.fury.io/js/prisma-error-enum.svg)](https://badge.fury.io/js/prisma-error-enum)\n# prisma-error-enum\n\nA more descriptive way to detect Prisma Errors. Reference: https://www.prisma.io/docs/reference/api-reference/error-reference#error-codes\n\n## Installation\n```shell\nyarn add prisma-error-enum\n```\n\n## Usage\n```typescript\nimport { PrismaError } from 'prisma-error-enum'\n\nconst createUser = () =\u003e {\n  try {\n    return await prisma.user.create({\n      data: {\n        email,\n      },\n    })\n  } catch (error) {\n    if (\n      error.code === PrismaError.UniqueConstraintViolation \u0026\u0026\n      error.meta.target[0] === 'email'\n    ) {\n      throw new BetterError(\n        'unique_email',\n        'This email is already registered by another user',\n        'email',\n      )\n    }\n\n    throw error\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinpac%2Fprisma-error-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinpac%2Fprisma-error-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinpac%2Fprisma-error-enum/lists"}