gerror

package
v0.181.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Init = sync.OnceValue(func() error {
	cfg, err := gcp.LoadConfig()
	if err != nil {
		return fmt.Errorf("load config: %w", err)
	}
	errorClient, err = errorreporting.NewClient(context.Background(), cfg.ProjectID, errorreporting.Config{
		ServiceName:    cfg.Service,
		ServiceVersion: config.GetVersion(),
		OnError: func(err error) {
			slog.Error("Create new error client failed.", slog.Any("error", err))
		},
	})
	if err != nil {
		return fmt.Errorf("load error reporting client: %w", err)
	}
	slog.Info("GCP error client created.")
	return nil
})

Functions

func ReportError

func ReportError(ctx context.Context, rawErr error)

ReportError reports an error to the Cloud Console. The error client auto populates the error context of the error. For more details about the context see: https://cloud.google.com/error-reporting/reference/rest/v1beta1/ErrorContext.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL