Documentation ¶
Overview ¶
Package msg provides common message functions.
Index ¶
- func FatalInfoOnErr(err error, info string)
- func FatalInfoOnFalse(flag bool, info string)
- func FatalInfoOnTrue(flag bool, info string)
- func FatalOnErr(err error)
- func FatalOnTrue(flag bool)
- func Info(info string)
- func InfoOnErr(err error, info string)
- func InfoOnFalse(flag bool, info string)
- func InfoOnTrue(flag bool, info string)
- func OnErr(err error)
- func OnFalse(flag bool)
- func OnTrue(flag bool)
- func PanicOnErr(err error, info string)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FatalInfoOnErr ¶
FatalInfoOnErr ends in osExit(1) if err not nil.
func FatalInfoOnFalse ¶ added in v0.26.0
FatalInfoOnFalse prints info and a common error message with location info when err is not nil.
func FatalInfoOnTrue ¶ added in v0.26.0
FatalInfoOnTrue prints info and a common error message with location info when err is not nil.
func InfoOnErr ¶
InfoOnErr prints info and a common error message with location info when err is not nil.
Example (A) ¶
package main import ( "errors" "github.com/rokath/trice/pkg/msg" ) func main() { var e error msg.OnErr(e) e = errors.New("s.th. went wrong") msg.OnErr(e) }
Output: Error in msg_test.go:16: func 'github.com/rokath/trice/pkg/msg_test.ExampleInfoOnErr_a' -> s.th. went wrong
Example (B) ¶
package main import ( "errors" "github.com/rokath/trice/pkg/msg" ) func main() { var e error msg.OnErr(e) e = errors.New("s.th. went wrong") msg.OnErr(e) }
Output: Error in msg_test.go:25: func 'github.com/rokath/trice/pkg/msg_test.ExampleInfoOnErr_b' -> s.th. went wrong
func InfoOnFalse ¶
InfoOnFalse prints info and a common error message with location info when flag is false.
func InfoOnTrue ¶
InfoOnTrue prints info and a common error message with location info when flag is true.
func OnErr ¶
func OnErr(err error)
OnErr prints info and a common error message with location info when err is not nil.
func OnFalse ¶
func OnFalse(flag bool)
OnFalse prints info and a common error message with location info when flag is false.
Types ¶
This section is empty.