msg

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package msg provides common message functions.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FatalInfoOnErr

func FatalInfoOnErr(err error, info string)

FatalInfoOnErr ends in osExit(1) if err not nil.

func FatalInfoOnFalse added in v0.26.0

func FatalInfoOnFalse(flag bool, info string)

FatalInfoOnFalse prints info and a common error message with location info when err is not nil.

func FatalInfoOnTrue added in v0.26.0

func FatalInfoOnTrue(flag bool, info string)

FatalInfoOnTrue prints info and a common error message with location info when err is not nil.

func FatalOnErr

func FatalOnErr(err error)

FatalOnErr ends in osExit(1) if err not nil.

func FatalOnTrue

func FatalOnTrue(flag bool)

FatalOnTrue ends in osExit(1) if flag is true.

func Info

func Info(info string)

Info prints info with location info.

func InfoOnErr

func InfoOnErr(err error, info string)

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

func InfoOnFalse(flag bool, info string)

InfoOnFalse prints info and a common error message with location info when flag is false.

func InfoOnTrue

func InfoOnTrue(flag bool, info string)

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.

func OnTrue

func OnTrue(flag bool)

OnTrue prints info and a common error message with location info when flag is true.

func PanicOnErr

func PanicOnErr(err error, info string)

PanicOnErr ends in panic if err not nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL