Open
Conversation
D5ng
commented
Feb 17, 2025
src/service/game-setting.js
Outdated
| setState({ min, max, answer }) | ||
| } catch (error) { | ||
| console.log(error) | ||
| throw new Error("최소값, 최대값을 설정하는데 에러가 발생했어요.") |
Author
There was a problem hiding this comment.
이러면 에러전파되는게 큰 의미가 없어보이네요.
error.message가 있다면 내용을 보여주고 없다면 기본 에러 메세지를 설정하는게 좋은것같네요
D5ng
commented
Feb 17, 2025
src/service/game-start.js
Outdated
| import { state } from "../model" | ||
| import { readLineAsync, NumberTypeError } from "../utils" | ||
|
|
||
| export async function start() { |
Author
There was a problem hiding this comment.
여러 로직을 포함하다보니, 맥락을 파악하기 힘드네요. 각 로직을 함수로 분리하는것이 좋아보입니다.
src/service/game-start.js
Outdated
| return false | ||
| } | ||
|
|
||
| function resetGameSettings() { |
Author
There was a problem hiding this comment.
기존에 만든 setState로 상태를 업데이트하는게 좋아보입니다.
현 코드에선 state를 변경해도 실제 상태에서는 변경되지 않는 문제가 있어요.
src/utils/error.js
Outdated
| @@ -0,0 +1,6 @@ | |||
| export class NumberTypeError extends Error { | |||
Author
There was a problem hiding this comment.
custom error를 어떻게 사용하는게 좋을지 고민 해야합니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ 요구사항
📝 구현 내용
커밋이 많이 더러워졌습니다... 코드를 push 했을 당시엔 최선이였는데, 하루가 지날 때마다 더 좋은 생각(?)이 나서 수정하다보니 이렇게 됐습니다 😂