all panic use Error

This commit is contained in:
slene
2013-10-09 11:37:16 +08:00
parent aaf1490ff5
commit 658a671b79
8 changed files with 38 additions and 37 deletions

View File

@@ -23,10 +23,10 @@ func (o *insertSet) Insert(md interface{}) (int64, error) {
typ := ind.Type()
name := getFullName(typ)
if val.Kind() != reflect.Ptr {
panic(fmt.Sprintf("<Inserter.Insert> cannot use non-ptr model struct `%s`", name))
panic(fmt.Errorf("<Inserter.Insert> cannot use non-ptr model struct `%s`", name))
}
if name != o.mi.fullName {
panic(fmt.Sprintf("<Inserter.Insert> need model `%s` but found `%s`", o.mi.fullName, name))
panic(fmt.Errorf("<Inserter.Insert> need model `%s` but found `%s`", o.mi.fullName, name))
}
id, err := o.orm.alias.DbBaser.InsertStmt(o.stmt, o.mi, ind, o.orm.alias.TZ)
if err != nil {