Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[错误处理] 从返回的数据库错误中,解析数据冲突的字段

Open
#45 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
mongodb, typescript
Domain
backend, databases

Research direction

Start in user/user.controller.ts by reviewing createUser, updateUser, and upsertUserByEmployeeId, then inspect the new upserByUsername/email/phone functions and their TODO. Read mongo/mongo.interceptor.ts to understand where MongoDB errors are intercepted. Done means extracting the conflicting field from the returned database error and removing the repeated handling logic.

Written by the indexing model from the issue text.

Description

adventurer refactor

需要重构的地方

user/user.controller.ts

查看这几个方法,会发现有大量的重复代码

  • createUser
  • updateUser
  • upsertUserByEmployeeId

在新启用的 upserByUsername/email/phone 函数中,加了一个注解

// TODO: 从返回的数据库错误中,解析数据冲突的字段

我们本次需要实现这个

开发建议

  • 在 mongo/mongo.interceptor.ts 中已经拦截 mongodb 的错误,在这里进一步处理错误
Dominant language
TypeScript
Stars
1
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.