errorhandler/main.go

16 lines
340 B
Go
Raw Permalink Normal View History

2023-03-21 18:21:57 +00:00
package errorhandler
2023-03-22 15:36:16 +00:00
import (
"fmt"
"log"
)
2023-03-21 18:21:57 +00:00
// FormatError formats text and the error in a standardized way
func FormatError(text string, err error) error {
return fmt.Errorf(fmt.Sprintf("%s, error is:\n\t-> %s", text, err))
}
2023-03-22 15:36:16 +00:00
func FormatFatal(text string, err error) {
log.Fatalf(fmt.Sprintf("%s, error is:\n\t-> %s", text, err))
}