Skip to content

Commit

Permalink
fix: handle additional errors and keep the input after entering value
Browse files Browse the repository at this point in the history
  • Loading branch information
cindrmon committed Jun 29, 2022
1 parent ad146d1 commit dcd0b1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CalculatorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ private void Calculate()
{
lblResultOutput.Text = rawAnswer.ToString();
}


}
catch (InvalidCastException icEx)
{
lblErrorText.Text = "Error: Invalid Syntax";
}
catch (SyntaxErrorException seEx)
{
Expand All @@ -51,7 +55,6 @@ private void Calculate()
{
lblErrorText.Text = "Error: Invalid Syntax";
}
ClearInput();
}

private void ClearInput()
Expand Down

0 comments on commit dcd0b1e

Please sign in to comment.