♻️ 🐛 🚨 Refactor URIs and handle URI exceptions in prototype
continuous-integration/drone/push Build is passing Details

pull/106/head
Alexis Drai 3 years ago
parent d4d587afb9
commit f12997f1f8

@ -220,9 +220,23 @@ namespace App
Console.WriteLine("create a face with an image uri, or enter 'ok' if you're finished");
menuChoiceNewFaces = Console.ReadLine();
if (menuChoiceNewFaces != "ok") faces.Add(new(new Uri(menuChoiceNewFaces)));
if (menuChoiceNewFaces != "ok")
{
try
{
faces.Add(new(new Uri(menuChoiceNewFaces)));
}
catch (ArgumentNullException ex)
{
Console.WriteLine(ex.Message);
}
catch (UriFormatException ex)
{
Console.WriteLine("that URI was not valid");
Console.WriteLine(ex.Message);
}
}
}
die = new ImageDie(faces.ToArray());
return die;
}

@ -43,12 +43,14 @@ namespace Data
monopolyDice.Add(new ColorDie(colorFaces));
string rootPath = "https://unsplash.com/photos/";
ImageFace[] imageFaces = new ImageFace[]
{
new(new Uri("https://unsplash.com/photos/TLD6iCOlyb0")),
new(new Uri("https://unsplash.com/photos/rTZW4f02zY8")),
new(new Uri("https://unsplash.com/photos/Hyu76loQLdk")),
new(new Uri("https://unsplash.com/photos/A_Ncbi-RH6s")),
new(new Uri(rootPath + "TLD6iCOlyb0")),
new(new Uri(rootPath + "rTZW4f02zY8")),
new(new Uri(rootPath + "Hyu76loQLdk")),
new(new Uri(rootPath + "A_Ncbi-RH6s")),
};
monopolyDice.Add(new ImageDie(imageFaces));

Loading…
Cancel
Save