Merge branch 'bugfix/bad_color_error' into 'develop'

add the provided color name to the error string

### Summary
Be more descriptive in the bad color name error for easier debugging.

Current:
`Reason
MVMCoreUI.Color.ColorError.badName(reason: "Check the spelling of your color.")`

https://onenr.io/0MRNEPy72wn

Co-authored-by: Kyle Matthew Hedden <kyle.hedden@verizonwireless.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/920
This commit is contained in:
Pfeil, Scott Robert 2023-01-06 22:08:49 +00:00
commit 4359fcb85f

View File

@ -106,7 +106,7 @@ public final class Color: Codable {
if colorString.hasPrefix("#") {
hex = colorString.replacingOccurrences(of: "#", with: "")
} else {
guard let hexString = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") }
guard let hexString = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color: \(colorString)") }
hex = hexString.replacingOccurrences(of: "#", with: "")
name = colorString
}