func makeXRayError()

in lambda/invoke_loop.go [188:212]


func makeXRayError(invokeResponseError *messages.InvokeResponse_Error) *xrayError {
	paths := make([]string, 0, len(invokeResponseError.StackTrace))
	visitedPaths := make(map[string]struct{}, len(invokeResponseError.StackTrace))
	for _, frame := range invokeResponseError.StackTrace {
		if _, exists := visitedPaths[frame.Path]; !exists {
			visitedPaths[frame.Path] = struct{}{}
			paths = append(paths, frame.Path)
		}
	}

	cwd, _ := os.Getwd()
	exceptions := []xrayException{{
		Type:    invokeResponseError.Type,
		Message: invokeResponseError.Message,
		Stack:   invokeResponseError.StackTrace,
	}}
	if exceptions[0].Stack == nil {
		exceptions[0].Stack = []*messages.InvokeResponse_Error_StackFrame{}
	}
	return &xrayError{
		WorkingDirectory: cwd,
		Paths:            paths,
		Exceptions:       exceptions,
	}
}