Skip to content

Add optional message to faults #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Assets/UXF/Scripts/UI/Form/FormElementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public void DisplayFault()
Invoke("ResetTitle", 5);
}

public void DisplayFault(string message)
{
title.text = string.Format("{0} <b><color=red>(!) Error: {1}</color></b>", originalTitle, message);
Invoke("ResetTitle", 8);
}

public void ResetTitle()
{
title.text = originalTitle;
Expand Down
4 changes: 2 additions & 2 deletions Assets/UXF/Scripts/UI/ParticipantListSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public string Finish()
// check if not empty
if (ppid.Replace(" ", string.Empty) == string.Empty)
{
form.ppidElement.controller.DisplayFault();
form.ppidElement.controller.DisplayFault("Invalid participant name!");
throw new Exception("Invalid participant name!");
}

Expand All @@ -226,7 +226,7 @@ public string Finish()
DataRow searchResultRow = ppList.AsEnumerable().FirstOrDefault(r => r.Field<string>("ppid") == ppid);
if (searchResultRow != null)
{
form.ppidElement.controller.DisplayFault();
form.ppidElement.controller.DisplayFault("Participant ID already exists!");
throw new Exception("Participant ID already exists! Enter a new ID or select the existing participant from the dropdown.");
}
// else new id has been entered
Expand Down