Skip to content

Commit

Permalink
Export conversion error ErrorUnexpectedTypeConversion (#1227)
Browse files Browse the repository at this point in the history
* Export conversion error

* Remove redundant line

* Fix name of error
  • Loading branch information
ivanahuckova authored Feb 10, 2025
1 parent c1d3936 commit 57415c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/sqlutil/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sqlutil

import (
"database/sql"
"errors"
"fmt"
"reflect"
"regexp"
Expand All @@ -11,6 +12,8 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/data"
)

var ErrorUnexpectedTypeConversion = errors.New("conversion error")

// FrameConverter defines how to convert the scanned value into a value that can be put into a dataframe (OutputFieldType)
type FrameConverter struct {
// FieldType is the type that is created for the dataframe field.
Expand Down Expand Up @@ -451,5 +454,6 @@ var TimeToNullableTime = data.FieldConverter{
}

func toConversionError(expected string, v interface{}) error {
return fmt.Errorf(`expected %s input but got type %T for value "%v"`, expected, v, v)
return fmt.Errorf(`%w, expected %s input but got type %T for value "%v"`,
ErrorUnexpectedTypeConversion, expected, v, v)
}

0 comments on commit 57415c7

Please sign in to comment.