starlarkerrors

package
v0.0.0-...-3de7540 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

README

error

error(*args, **kwargs) creates a new error.

Parameter Type Description
*args []any Args like print.
**kwargs {}any Kwargs like print.

error·matches

e.matches(pattern) returns True if the regex pattern matches the error string.

Parameter Type Description
pattern string Regex pattern to match.

error·kind

e.kind(err) returns True if the error is of the same kind as err.

Parameter Type Description
err error Error to compare against.

catch

catch(fn, *args, **kwargs) evaluates the provided function and returns a result. Catch allows starlark code to capture errors returned from a function call. The function must be a callable that accepts the remaining args and kwargs passed to catch.

Parameter Type Description
fn function Function to call.
*args []any Args for fn.
**kwargs {}any Kwargs for fn.

Documentation

Overview

Package errors implements functions to manipulate errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCatch

func MakeCatch(thread *starlark.Thread, _ string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

MakeCatch evaluates f() and returns its evaluation error message if it failed or the value if it succeeded.

func MakeError

func MakeError(thread *starlark.Thread, _ string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func NewModule

func NewModule() *starlarkstruct.Module

Types

type Error

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

func NewError

func NewError(err error) Error

func (Error) Attr

func (e Error) Attr(name string) (starlark.Value, error)

func (Error) AttrNames

func (e Error) AttrNames() []string

func (Error) Err

func (e Error) Err() error

func (Error) Error

func (e Error) Error() string

func (Error) Freeze

func (e Error) Freeze()

func (Error) Hash

func (e Error) Hash() (uint32, error)

func (Error) String

func (e Error) String() string

func (Error) Truth

func (e Error) Truth() starlark.Bool

func (Error) Type

func (e Error) Type() string

type Result

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

func (Result) Attr

func (v Result) Attr(name string) (starlark.Value, error)

func (Result) AttrNames

func (v Result) AttrNames() []string

func (Result) Freeze

func (v Result) Freeze()

func (Result) Hash

func (v Result) Hash() (uint32, error)

func (Result) String

func (v Result) String() string

func (Result) Truth

func (v Result) Truth() starlark.Bool

func (Result) Type

func (v Result) Type() string

Jump to

Keyboard shortcuts

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