Example #1
0
func convertMultiStack(m *stack.Multi) []Exception {
	l := make([]Exception, len(m.Stacks()))

	for i, s := range m.Stacks() {
		l[(len(l)-1)-i] = Exception{
			ErrorClass: "*stackerr.Error",
			Message:    fmt.Sprintf("relayed at line %d of %q", s[0].Line, s[0].File),
			Stacktrace: convertStack(s),
		}
	}

	return l
}
Example #2
0
// MultiStack returns the best possible stack.Multi from the error or nil if
// one isn't found.
func MultiStack(err error) *stack.Multi {
	switch err := err.(type) {
	case *singleFrameError:
		var m stack.Multi
		m.Add(stack.Stack{err.frame})
		return &m
	case *singleStackError:
		var m stack.Multi
		m.Add(err.stack)
		return &m
	case *multiStackError:
		return err.multiStack
	}
	return nil
}