File: capture_options.go

package info (click to toggle)
golang-gitlab-gitlab-org-labkit 1.17.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,092 kB
  • sloc: sh: 210; javascript: 49; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package errortracking

import (
	"github.com/getsentry/sentry-go"
)

// CaptureOption will configure how an error is captured.
type CaptureOption func(*captureConfig, *sentry.Event)

type captureConfig struct {
	attachStackTrace bool
}

func applyCaptureOptions(opts []CaptureOption) (captureConfig, *sentry.Event) {
	event := sentry.NewEvent()
	event.Level = sentry.LevelError

	config := captureConfig{}

	for _, v := range opts {
		v(&config, event)
	}

	return config, event
}