forked from maddyblue/sqlfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal_errors.go
executable file
·32 lines (27 loc) · 1.01 KB
/
internal_errors.go
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
26
27
28
29
30
31
32
// Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package pgerror
import (
"fmt"
"github.com/cockroachdb/errors"
)
// This file provides facilities to track internal errors.
// NewInternalTrackingError instantiates an error
// meant for use with telemetry.ReportError directly.
//
// Do not use this! Convert uses to AssertionFailedf or similar
// above.
func NewInternalTrackingError(issue int, detail string) error {
key := fmt.Sprintf("#%d.%s", issue, detail)
err := errors.AssertionFailedWithDepthf(1, "%s", errors.Safe(key))
err = errors.WithTelemetry(err, key)
err = errors.WithIssueLink(err, errors.IssueLink{IssueURL: fmt.Sprintf("https://sqlfmt/cockroach/issues/%d", issue)})
return err
}