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

     1  package errcore
     2  
     3  import "fmt"
     4  
     5  func ErrorWithCompiledTraceRef(
     6  	err error,
     7  	compiledTraces string,
     8  	reference interface{},
     9  ) string {
    10  	if err == nil {
    11  		return ""
    12  	}
    13  
    14  	if compiledTraces == "" {
    15  		return ErrorWithRef(err, reference)
    16  	}
    17  
    18  	if reference == nil {
    19  		return fmt.Sprintf(
    20  			messageWithTracesWithoutRefFormat,
    21  			err.Error(),
    22  			compiledTraces,
    23  		)
    24  	}
    25  
    26  	return fmt.Sprintf(
    27  		messageWithTracesRefFormat,
    28  		err.Error(),
    29  		compiledTraces,
    30  		reference)
    31  }