refactor: throw new Error 도메인 오류 정리 (P1-2)#116
Conversation
도메인 입력 오류를 throw new Error 대신 HttpException 으로 변환. boot-time fail-fast(config/JWT_ACCESS_SECRET 누락 등)는 그대로 유지. - oidc-provider.type.ts: throw new Error → BadRequestException (FE 응답 500→400) - 호출 컨텍스트: HTTP request path (auth.controller 콜백 + oidc-login.service) - 협의 #3 대상 — 500 retry 로직이 있다면 제거 필요 - id-parser.ts / parse-account-id.ts: 같은 함수 내 try/catch 제어흐름용 throw new Error 'empty'/'negative' 제거. BadRequestException 직접 throw 로 단순화. 외부 동작 동일 (이미 catch 에서 BadRequestException 으로 변환됨).
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1174 tests passing in 142 suites. Report generated by 🧪jest coverage report action from 31634e7 |
Summary
도메인 입력 오류 (request path) 를
throw new Error대신 HttpException 으로 변환한다.boot-time fail-fast (config / JWT_ACCESS_SECRET 누락 등) 는 운영 의도(500) 와 일치하므로 그대로 유지.
Scope
src/features/auth/types/oidc-provider.type.tsthrow new Error→BadRequestExceptionauth.controller.ts:97OIDC 콜백,oidc-login.service.ts:51,75Unsupported OIDC provider: <raw>)src/common/utils/id-parser.tssrc/global/auth/parse-account-id.tsthrow new Error('empty'/'negative')제거BadRequestException직접 throw 로 단순화. 외부 응답은 이미 400 으로 동일.src/config/{oidc,auth,docs,s3,database}.config.tssrc/common/helpers/config.helper.ts(mustGetEnv)src/global/auth/auth-global.module.ts(JwtModule factory)src/features/auth/strategies/jwt-bearer.strategy.ts(생성자)FE 협의 #3 — 액션 요청
대상 경로:
/auth/oidc/<provider>/...(구체적으로 invalid provider slug 가 들어온 경우){ statusCode: 400, message: "Unsupported OIDC provider: <raw>" }Impact
Test plan
BadRequestExceptionassertion 추가BadRequestExceptionassertion 그대로 통과