MCPcopy
hub / github.com/uber/aresdb / StackError

Function StackError

utils/error.go:58–85  ·  view source on GitHub ↗

StackError adds one more line of message to err. It updates err if it's already a StackedError, otherwise creates a new StackedError with the message from err and the stack trace of current goroutine.

(err error, message string, args ...interface{})

Source from the content-addressed store, hash-verified

56// It updates err if it's already a StackedError, otherwise creates a new StackedError
57// with the message from err and the stack trace of current goroutine.
58func StackError(err error, message string, args ...interface{}) *StackedError {
59 if err == nil {
60 stack := make([]byte, 0x10000)
61 runtime.Stack(stack, false)
62 e := &StackedError{
63 []string{fmt.Sprintf(message, args...)},
64 strings.Split(string(stack), "\n"),
65 }
66 e.Stack = e.Stack[:len(e.Stack)-1]
67 return e
68 }
69
70 e, ok := err.(*StackedError)
71 if !ok {
72 stack := make([]byte, 0x10000)
73 runtime.Stack(stack, false)
74 e = &StackedError{
75 []string{err.Error()},
76 strings.Split(string(stack), "\n"),
77 }
78 e.Stack = e.Stack[:len(e.Stack)-1]
79 }
80
81 if message != "" {
82 e.Messages = append(e.Messages, fmt.Sprintf(message, args...))
83 }
84 return e
85}
86
87// RecoverWrap recover all panics inside the passed in func
88func RecoverWrap(call func() error) (err error) {

Callers 15

TranslateEnumMethod · 0.92
fetchAndSetEnumCasesMethod · 0.92
ExtendEnumCasesMethod · 0.92
FetchAllSchemasMethod · 0.92
readJSONResponseMethod · 0.92
InsertMethod · 0.92
computeHLLValueFunction · 0.92
checkPrimaryKeysFunction · 0.92
checkTimeColumnExistenceFunction · 0.92
PrepareUpsertBatchMethod · 0.92
DoCGoCallFunction · 0.92
GetSchemaHashMethod · 0.92

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected