xerr

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 0 Imported by: 1

Documentation

Overview

Package xerr is a simplistic (and more efficient) re-write of the "errors" built-in package.

This is used to create comparable and (sometimes) un-wrapable error structs.

This package acts differently when the "implant" build tag is used. If enabled, Most error string values are stripped to prevent identification and debugging.

It is recommended if errors are needed to be compared even when in an implant build, to use the "Sub" function, which will ignore error strings and use error codes instead.

Index

Constants

View Source
const ExtendedInfo = true

ExtendedInfo is a compile time constant to help signal if complex string values should be concatenated inline.

This helps prevent debugging when the "-tags implant" option is enabled.

Variables

This section is empty.

Functions

func New

func New(s string) error

New creates a new string backed error interface and returns it. This error struct does not support Unwrapping.

The resulting errors created will be comparable.

func Sub added in v0.2.0

func Sub(s string, _ uint8) error

Sub creates a new string backed error interface and returns it. This error struct does not support Unwrapping.

If the "-tags implant" option is selected, the second value, the error code, will be used instead, otherwise it's ignored.

The resulting errors created will be comparable.

func Wrap

func Wrap(s string, e error) error

Wrap creates a new error that wraps the specified error.

If not nil, this function will append ": " + 'Error()' to the resulting string message and will keep the original error for unwrapping.

If "-tags implant" is specified, this will instead return the wrapped error directly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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