errext

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errext contains extensions for normal Go errors that are used in k6.

Index

Constants

View Source
const AbortTest = "test aborted"

AbortTest is the reason emitted when a test script calls test.abort()

Variables

This section is empty.

Functions

func IsInterruptError

func IsInterruptError(err error) bool

IsInterruptError returns true if err is *InterruptError.

func WithExitCodeIfNone

func WithExitCodeIfNone(err error, exitCode exitcodes.ExitCode) error

WithExitCodeIfNone can attach an exit code to the given error, if it doesn't have one already. It won't do anything if the error already had an exit code attached. Similarly, if there is no error (i.e. the given error is nil), it also won't do anything.

func WithHint

func WithHint(err error, hint string) error

WithHint is a helper that can attach a hint to the given error. If there is no error (i.e. the given error is nil), it won't do anything. If the given error already had a hint, this helper will wrap it so that the new hint is "new hint (old hint)".

Types

type Exception

type Exception interface {
	error
	StackTrace() string
}

Exception represents errors that resulted from a script exception and contain a stack trace that lead to them.

type HasExitCode

type HasExitCode interface {
	error
	ExitCode() exitcodes.ExitCode
}

HasExitCode is a wrapper around an error with an attached exit code.

type HasHint

type HasHint interface {
	error
	Hint() string
}

HasHint is a wrapper around an error with an attached user hint. These hints can be used to give extra human-readable information about the error, including suggestions on how the error can be fixed.

type InterruptError

type InterruptError struct {
	Reason string
}

InterruptError is an error that halts engine execution

func (*InterruptError) Error

func (i *InterruptError) Error() string

Error returns the reason of the interruption.

func (*InterruptError) ExitCode

func (i *InterruptError) ExitCode() exitcodes.ExitCode

ExitCode returns the status code used when the k6 process exits.

Directories

Path Synopsis
Package exitcodes contains the constants representing possible k6 exit error codes.
Package exitcodes contains the constants representing possible k6 exit error codes.

Jump to

Keyboard shortcuts

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