errutil

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RetryLimit is a number how many times bucket creation is retried before returning an error.
	RetryLimit = 3
)

Variables

This section is empty.

Functions

func Check

func Check(err error)

Check checks if an error is present. If it is present, it displays the error and exits with status 1. If you want to display a custom message use CheckWithMessage.

func ErrAlreadyExists

func ErrAlreadyExists(description, filename string, location Location)

ErrAlreadyExists is called in case of a file conflict.

func ErrNotFound

func ErrNotFound(filename string, location Location)

ErrNotFound is called when a source copied from doesn't exists.

func Exit

func Exit(code int)

Exit quits the application with a given value.

func RetryOnFailure added in v0.3.0

func RetryOnFailure(msg string, toRun func() bool) (ok bool)

RetryOnFailure calls the given function for a certain (RetryLimit) number of times. The function should be an inline function, so it can set return values. The function returns an error. The retries stop, if the result is ok. After the certain number of times expired, it logs the error anyway.

Types

type Location

type Location int

Location is an enum for choosing between local file system of Google Cloud Storage.

const (
	// Lfs is the local file system enum value.
	Lfs Location = iota
	// Gcs is the Google Cloud Storage enum value.
	Gcs
)

Jump to

Keyboard shortcuts

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