github.com/iikira/iikira-go-utils@v0.0.0-20230610031953-f2cb11cde33a/utils/prealloc/errors.go (about)

     1  package prealloc
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  type (
     8  	PreAllocError struct {
     9  		ProcName string
    10  		Err      error
    11  	}
    12  )
    13  
    14  func (pe *PreAllocError) Error() string {
    15  	if pe.Err == nil {
    16  		return "<nil>"
    17  	}
    18  	return fmt.Sprintf("%s error: %s\n", pe.ProcName, pe.Err)
    19  }