chore: Show color name in ColorNotFoundException msg

This commit is contained in:
John Colvin committed 2022-08-07 13:51:52 -04:00
1 parent 776b9e4f94
commit 528bab34e7
2 files changed
+3 -4

No files matched your search

@@ -6,8 +6,7 @@ using System.Threading.Tasks;
namespace mbts.ui {
class ColorNotFoundException : Exception {
public ColorNotFoundException() : base("The color is not defined in BTSColors") { }
public ColorNotFoundException(String message) : base(message) { }
public ColorNotFoundException(String message, Exception inner) : base(message, inner) { }
public ColorNotFoundException(string name = null, Exception inner = null)
: base($"The color '{name}' is not defined in BTSColors", inner) { }
}
}
@@ -27,7 +27,7 @@ namespace mbts.ui {
public static BTSColor get_color(string name) =>
_color_map.TryGetValue(name, out var color) ?
color() : throw new ColorNotFoundException();
color() : throw new ColorNotFoundException(name);
public override object? ProvideValue(IServiceProvider service_provider) {
if (service_provider is null) {