Skip to content

Commit

Permalink
Separate user error from debug error messages in popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlo-Ong committed May 15, 2024
1 parent 03f9205 commit ac13f34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Assets/Scripts/ChatResponseSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private bool SerializeChatResponse(string response)

catch (Exception err)
{
StateMachine.Instance.ThrowError("Serialization of ChatGPT response failed - please try again", State.MainMenu);
StateMachine.Instance.ThrowError(err.Message, "Serialization of ChatGPT response failed - please try again", State.MainMenu);
return false;
}
}
Expand All @@ -162,7 +162,7 @@ private Question JSONifyQuestion(GameQuestion q)

catch (Exception err)
{
StateMachine.Instance.ThrowError(err.Message);
Debug.Log(err.Message); // non-essential error
}

return null;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/StateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ private void StateExit(State state)

# endregion

public void ThrowError(string err, State revertState = State.None)
public void ThrowError(string err, string userErr = null, State revertState = State.None)
{
Debug.LogError(err);
Canvas_ErrorMessage.SetActive(true);
Canvas_ErrorMessage.GetComponentInChildren<TMP_Text>().text = err;
Canvas_ErrorMessage.GetComponentInChildren<TMP_Text>().text = userErr ?? err;
if (revertState != State.None)
{
ChangeToState(revertState);
Expand Down

0 comments on commit ac13f34

Please sign in to comment.