From 0e4d954fa78d1e862020ee87bf88e60d26a23d05 Mon Sep 17 00:00:00 2001 From: Atallah khedrane Date: Sun, 23 Sep 2018 12:18:15 +0200 Subject: [PATCH] Return error when wrong filtering field When end user put wrong filtering field ORM should return error instead of Panic() so developers can handle this error. --- orm/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orm/db.go b/orm/db.go index 87d08df6..61f747cd 100644 --- a/orm/db.go +++ b/orm/db.go @@ -928,7 +928,7 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi maps[fi.column] = true } } else { - panic(fmt.Errorf("wrong field/column name `%s`", col)) + return -1, fmt.Errorf("wrong field/column name `%s`", col) } } if hasRel {