Compiler

compiler/errlist

github.com/gopherjs/gopherjs/compiler/errlist

import "github.com/gopherjs/gopherjs/compiler/errlist"

Variables

ErrTooManyErrors is added to the ErrorList by the Trim method.

Source: compiler/errlist/errlist.go:9

var ErrTooManyErrors = errors.New("too many errors")

Types

type ErrorList

Source: compiler/errlist/errlist.go:12

ErrorList wraps multiple errors as a single error.

type ErrorList []error

func Append(err error) ErrorList

Source: compiler/errlist/errlist.go:37

Append an error to the list.

If err is an instance of ErrorList, the lists are concatenated together, otherwise err is appended at the end of the list. If err is nil, the list is returned unmodified.

err := DoStuff()
errList := errList.Append(err)

func AppendDistinct(err error) ErrorList

Source: compiler/errlist/errlist.go:49

AppendDistinct is similar to Append, but doesn't append the error if it has the same message as the last error on the list.

func ErrOrNil() error

Source: compiler/errlist/errlist.go:22

ErrOrNil returns nil if ErrorList is empty, or the error otherwise.

func ErrorList) Error() string

Source: compiler/errlist/errlist.go:14

func Trim(limit int) ErrorList

Source: compiler/errlist/errlist.go:62

Trim the error list if it has more than limit errors. If the list is trimmed, all extraneous errors are replaced with a single ErrTooManyErrors, making the returned ErrorList length of limit+1.