format

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package format defines string formatting utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(values ...string) string

And connects the given values together in an English list using an "and" as a conjunction and an Oxford comma.

func Err

func Err(err error) string

Err returns the error's string, but may also reformat that error string to be a little more human-friendly.

In particular, it returns the gRPC status message only if the message is a gRPC error. Otherwise, those errors output a lot of mostly useless line noise in addition to the error message.

func WrapErr

func WrapErr(err error, msg string, args ...any) error

WrapErr returns a wrapped error. The wrapped error will be reformatted using FormatErr because some error handlers are determined to make their errors difficult for humans to read and understand.

Types

type WrapError

type WrapError struct {
	// contains filtered or unexported fields
}

WrapError is a generic error wrapper generated by the WrapErr function.

func (*WrapError) Error

func (err *WrapError) Error() string

Error returns the formatted error message.

func (*WrapError) Unwrap

func (err *WrapError) Unwrap() error

Unwrap provides the inner error.

Jump to

Keyboard shortcuts

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