1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-21 21:50:55 +00:00

improve null pointer panic message

This commit is contained in:
Alexey Sharov 2014-08-07 12:09:09 +07:00
parent cec151fda7
commit df8c73b23a
2 changed files with 4 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
.DS_Store .DS_Store
*.swp *.swp
*.swo *.swo

View File

@ -132,6 +132,9 @@ func getFieldType(val reflect.Value) (ft int, err error) {
case reflect.String: case reflect.String:
ft = TypeCharField ft = TypeCharField
default: default:
if elm == nil {
panic(fmt.Errorf("%s is nil pointer, may be miss setting tag", val))
}
switch elm.Interface().(type) { switch elm.Interface().(type) {
case sql.NullInt64: case sql.NullInt64:
ft = TypeBigIntegerField ft = TypeBigIntegerField