errutils

package
v0.76.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(errs []error) []error

func Merge

func Merge(errs ...error) error

Types

type Error

type Error string

Error is an implementation for the error interface that allow you to declare exported globals with the `const` keyword.

TL;DR:
  const ErrSomething errutils.Error = "something is an error"

func (Error) Error

func (err Error) Error() string

Error implement the error interface

Example
package main

import (
	"github.com/adamluzsi/frameless/pkg/errutils"
)

func main() {
	const ErrSomething errutils.Error = "something is an error"
}
Output:

type ErrorHandler

type ErrorHandler interface {
	// HandleError allow the interactor implementation to be notified about unexpected situations.
	HandleError(ctx context.Context, err error) error
}

ErrorHandler describes that an object able to handle error use-cases for its purpose.

For e.g. if the component is a pubsub subscription event handler, then implementing ErrorHandler means it suppose to handle unexpected use-cases such as connection interruption.

type Errors

type Errors []error

func (Errors) As

func (errs Errors) As(target any) bool

func (Errors) Clean

func (errs Errors) Clean() Errors

func (Errors) Err

func (errs Errors) Err() error

func (Errors) Error

func (errs Errors) Error() string

Jump to

Keyboard shortcuts

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