Esempio n. 1
0
func TestBuildStack(t *testing.T) {
	stack := BuildStack(note())
	if len(stack) != 4 {
		t.Errorf("len(stack) = %d != 4", len(stack))
	}
	fmt.Printf("%+v\n", stack)

	stack = BuildStack(c())
	if len(stack) != 3 {
		t.Errorf("len(stack) = %d != 3", len(stack))
	}

	stack = BuildStack(nil)
	if len(stack) != 0 {
		t.Errorf("len(stack) = %d != 0", len(stack))
	}

	stack = BuildStack(errors.New("error"))
	if len(stack) != 0 {
		t.Errorf("len(stack) = %d != 0", len(stack))
	}

	err := c()
	rollbar.ErrorWithStack(rollbar.ERR, err, BuildStack(err))
	rollbar.Wait()
}
Esempio n. 2
0
File: error.go Progetto: yannski/cli
func (r *ReportError) Report() {
	fields := []*rollbar.Field{&rollbar.Field{
		Name: "custom",
		Data: r,
	}}
	if r.User != nil {
		fields = append(fields, &rollbar.Field{
			Name: "person",
			Data: map[string]string{
				"id":       r.User.ID,
				"username": r.User.Username,
				"email":    r.User.Email,
			},
		})
	}
	rollbar.ErrorWithStack(rollbar.ERR, r.Error, errgorollbar.BuildStack(r.Error), fields...)
}