gitlab.com/evatix-go/core@v1.3.55/errcore/ErrorWithRef.go (about)

     1  package errcore
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  func ErrorWithRef(err error, reference interface{}) string {
     8  	if err == nil {
     9  		return ""
    10  	}
    11  
    12  	if reference == nil || reference == "" {
    13  		return err.Error()
    14  	}
    15  
    16  	return fmt.Sprintf(
    17  		messageMapFormat,
    18  		err.Error(),
    19  		reference)
    20  }