maint: annotate source code

This commit is contained in:
2025-12-28 16:39:33 -05:00
parent 5fabd0233d
commit 11ab1630be
3 changed files with 41 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/fatih/color"
)
/* print out the current path (route) and relevant error */
func Path(path string, err error) {
path = strings.TrimPrefix(path, "/")
@@ -29,29 +30,35 @@ func Path(path string, err error) {
}
}
/* print general system warning */
func Warning(msg string, err error) error {
fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.MagentaString("warning"), err)
return err
}
/* print general system error */
func Error(msg string, err error) error {
fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.RedString("error"), err)
return err
}
/* print fatality and panic */
func Fatal(msg string, err error) error {
fmt.Printf("%s: %s: %v\n", version.PROGRAM_NAME, color.RedString("fatal"), err)
panic(err)
}
/* print message using the ok status color */
func OK(msg string) {
color.Green(msg)
}
/* print message using the warning status color */
func WARN(msg string) {
color.Magenta(msg)
}
/* print message using the error status color */
func ERROR(msg string) {
color.Red(msg)
}