From fc42a1bbf35c9fee8900d7d0fa9f61ab9eff8b26 Mon Sep 17 00:00:00 2001 From: Luke Cowell Date: Fri, 4 Dec 2015 14:56:21 -0800 Subject: [PATCH] provide user with more descriptive error message --- field.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/field.go b/field.go index a56dbe51..9e6891c8 100644 --- a/field.go +++ b/field.go @@ -3,6 +3,7 @@ package gorm import ( "database/sql" "errors" + "fmt" "reflect" ) @@ -44,7 +45,7 @@ func (field *Field) Set(value interface{}) error { if reflectValue.Type().ConvertibleTo(field.Field.Type()) { field.Field.Set(reflectValue.Convert(field.Field.Type())) } else { - return errors.New("could not convert argument") + return fmt.Errorf("could not convert argument of field %s from %s to %s", field.Name, reflectValue.Type(), field.Field.Type()) } }