chore: Show color name in ColorNotFoundException msg

This commit is contained in:
John Colvin committed 2022-07-19 15:27:33 -05:00
1 parent db22dc2853
commit a450d6447a
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) { }
}
}
@@ -53,7 +53,7 @@ namespace mbts.ui {
static BTSColor _get_color(string name) =>
_color_map.TryGetValue(name, out var color) ?
color() : throw new ColorNotFoundException();
color() : throw new ColorNotFoundException(name);
static IEnumerable<(string, Func<BTSColor>)> _normalized_color_props(
Type type, string? prefix) {