refactor: print stderr via fmt.Fprint with lipgloss.Sprintln instead of lipgloss.Fprintln

This commit is contained in:
aykhans committed 2026-08-17 20:11:47 +04:00
1 parent e13eb9b8a8
commit c195ca2ab2
3 files changed
+23 -27

No files matched your search

+7 -7
View File
@@ -33,13 +33,13 @@ func main() {
utilsErr.OnType(func(err types.FieldValidationErrors) error {
for _, fieldErr := range err.Errors {
if fieldErr.Value == "" {
lipgloss.Fprintln(os.Stderr,
fmt.Fprint(os.Stderr, lipgloss.Sprintln(
config.StyleYellow.Render(fmt.Sprintf("[VALIDATION] Field '%s': ", fieldErr.Field))+fieldErr.Err.Error(),
)
))
} else {
lipgloss.Fprintln(os.Stderr,
fmt.Fprint(os.Stderr, lipgloss.Sprintln(
config.StyleYellow.Render(fmt.Sprintf("[VALIDATION] Field '%s' (%s): ", fieldErr.Field, fieldErr.Value))+fieldErr.Err.Error(),
)
))
}
}
os.Exit(1)
@@ -59,17 +59,17 @@ func main() {
)
_ = utilsErr.MustHandle(err,
utilsErr.OnType(func(err types.ProxyDialError) error {
lipgloss.Fprintln(os.Stderr, config.StyleRed.Render("[PROXY] ")+err.Error())
fmt.Fprint(os.Stderr, lipgloss.Sprintln(config.StyleRed.Render("[PROXY] ")+err.Error()))
os.Exit(1)
return nil
}),
utilsErr.OnSentinel(types.ErrScriptEmpty, func(err error) error {
lipgloss.Fprintln(os.Stderr, config.StyleRed.Render("[SCRIPT] ")+err.Error())
fmt.Fprint(os.Stderr, lipgloss.Sprintln(config.StyleRed.Render("[SCRIPT] ")+err.Error()))
os.Exit(1)
return nil
}),
utilsErr.OnType(func(err types.ScriptLoadError) error {
lipgloss.Fprintln(os.Stderr, config.StyleRed.Render("[SCRIPT] ")+err.Error())
fmt.Fprint(os.Stderr, lipgloss.Sprintln(config.StyleRed.Render("[SCRIPT] ")+err.Error()))
os.Exit(1)
return nil
}),