Skip to content

Commit

Permalink
refactor: winners가 없을 경우 예외처리가 가능하도록 alert 함수 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yujo11 committed Feb 15, 2021
1 parent 0270679 commit b794b80
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/game/printGameResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { getWinners } from './getWinners.js';
import { restartGame } from './restartGame.js';

const alertGameResult = (winners) => {
if (!winners) {
alert('❌ Error : 우승자를 찾지 못 했습니다. ❌');
throw new Error('우승자를 찾지 못 했습니다.');
}

alert(`🎉 축하드립니다! 우승자는 ${winners}입니다! 🎉`);
};

Expand Down

0 comments on commit b794b80

Please sign in to comment.