Add error source (#1954)

Fixes  #1879
This commit is contained in:
Zoltán Bedi
2025-02-04 12:40:33 +01:00
committed by GitHub
parent 525217ddad
commit c2ffd31b1a
10 changed files with 164 additions and 21 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
"github.com/dlclark/regexp2"
"github.com/grafana/grafana-plugin-sdk-go/backend"
)
func (item *Item) ExpandItemName() string {
@@ -79,7 +80,7 @@ func parseFilter(filter string) (*regexp2.Regexp, error) {
if flagRE.MatchString(matches[2]) {
pattern += "(?" + matches[2] + ")"
} else {
return nil, fmt.Errorf("error parsing regexp: unsupported flags `%s` (expected [%s])", matches[2], vaildREModifiers)
return nil, backend.DownstreamError(fmt.Errorf("error parsing regexp: unsupported flags `%s` (expected [%s])", matches[2], vaildREModifiers))
}
}
pattern += matches[1]