Replaced 'panic' with an error return, and a call to 'printAndExit'
This commit is contained in:
5
color.go
5
color.go
@@ -49,10 +49,11 @@ func newColor(colorString string) (color, error) {
|
||||
return clr, nil
|
||||
}
|
||||
|
||||
// newColorMust is similar to newColor, but panics if the given color isn't valid.
|
||||
// newColorMust is similar to newColor, but prints an error and exits if the given color isn't valid.
|
||||
func newColorMust(colorString string) color {
|
||||
if clr, err := newColor(colorString); err != nil {
|
||||
panic(err)
|
||||
printAndExit(err.Error())
|
||||
panic(err) // NEVER REACHED
|
||||
} else {
|
||||
return clr
|
||||
}
|
||||
|
Reference in New Issue
Block a user