MCPcopy Create free account
hub / github.com/juju/errors / errorLocationValue

Function errorLocationValue

package_test.go:23–31  ·  view source on GitHub ↗

errorLocationValue provides the function name and line number for where this function was called from - 1 line. What this means is that the returned value will be homed to the file line directly above where this function was called. This is a utility for testing error details and that associated err

(c *gc.C)

Source from the content-addressed store, hash-verified

21// This is a utility for testing error details and that associated error calls
22// set the error location correctly.
23func errorLocationValue(c *gc.C) string {
24 rpc := make([]uintptr, 1)
25 n := runtime.Callers(2, rpc[:])
26 if n < 1 {
27 return ""
28 }
29 frame, _ := runtime.CallersFrames(rpc).Next()
30 return fmt.Sprintf("%s:%d", frame.Function, frame.Line-1)
31}

Callers 15

TestNewMethod · 0.85
TestErrorfMethod · 0.85
TestTraceMethod · 0.85
TestAnnotateMethod · 0.85
TestAnnotatefMethod · 0.85
TestWrapMethod · 0.85
TestWrapOfNilMethod · 0.85
TestWrapfMethod · 0.85
TestWrapfOfNilMethod · 0.85
TestMaskMethod · 0.85
TestMaskfMethod · 0.85
TestErrorStackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…