Quellcode durchsuchen

bug: return correct err message

if the sql query failed has is false and the method will return
m.ErrDataSourceNotFound which is incorrect. We now return the
correct error message from the query

ref #10843
bergquist vor 7 Jahren
Ursprung
Commit
1a041a2250
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  1. 3 0
      pkg/services/sqlstore/datasource.go

+ 3 - 0
pkg/services/sqlstore/datasource.go

@@ -27,6 +27,9 @@ func GetDataSourceById(query *m.GetDataSourceByIdQuery) error {
 
 
 	datasource := m.DataSource{OrgId: query.OrgId, Id: query.Id}
 	datasource := m.DataSource{OrgId: query.OrgId, Id: query.Id}
 	has, err := x.Get(&datasource)
 	has, err := x.Get(&datasource)
+	if err != nil {
+		return err
+	}
 
 
 	if !has {
 	if !has {
 		return m.ErrDataSourceNotFound
 		return m.ErrDataSourceNotFound