fermi/main/error.go

24 lines
407 B
Go
Raw Normal View History

2024-12-28 23:36:09 +00:00
package main
import (
"fmt"
)
type FermiError struct {
Code string
Msg string
}
func (e FermiError) Error() string {
return e.Msg
}
func PrintError(e error) {
if fermi_error, ok := e.(FermiError); ok {
fmt.Printf("Error: %s: %s\n", fermi_error.Code, fermi_error.Msg)
fmt.Printf("Type \"help\" or \"h\" to see grammar and command flags\n")
} else {
fmt.Printf("Error: %s\n", e.Error())
}
}