errorhandler/main.go

16 lines
340 B
Go

package errorhandler
import (
"fmt"
"log"
)
// 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))
}
func FormatFatal(text string, err error) {
log.Fatalf(fmt.Sprintf("%s, error is:\n\t-> %s", text, err))
}