Skip to content

Commit

Permalink
provide user with more descriptive error message
Browse files Browse the repository at this point in the history
  • Loading branch information
lcowell committed Dec 4, 2015
1 parent 4c1a78b commit fc42a1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion field.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package gorm
import (
"database/sql"
"errors"
"fmt"
"reflect"
)

Expand Down Expand Up @@ -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())
}
}

Expand Down

0 comments on commit fc42a1b

Please sign in to comment.