github.com/MetalBlockchain/metalgo@v1.11.9/utils/wrappers/errors.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package wrappers
     5  
     6  type Errs struct{ Err error }
     7  
     8  func (errs *Errs) Errored() bool {
     9  	return errs.Err != nil
    10  }
    11  
    12  func (errs *Errs) Add(errors ...error) {
    13  	if errs.Err == nil {
    14  		for _, err := range errors {
    15  			if err != nil {
    16  				errs.Err = err
    17  				break
    18  			}
    19  		}
    20  	}
    21  }