Add any type and output errors

This commit is contained in:
Archie Fox
2025-03-14 15:11:17 +03:00
parent debf1eec22
commit e7bb6ba60a
4 changed files with 25 additions and 8 deletions

View File

@@ -0,0 +1,16 @@
package output
import "github.com/fatih/color"
func PrintError(value any) {
switch t := value.(type) {
case string:
color.Red(t)
case int:
color.Red("Код ошибки: %d", t)
case error:
color.Red(t.Error())
default:
color.Red("Неизвестный тип ошибки")
}
}