Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a meta name that doesn't exist in model, give no obvious error #2

Open
sunfmin opened this issue Oct 5, 2016 · 1 comment
Open

Comments

@sunfmin
Copy link
Member

sunfmin commented Oct 5, 2016

The error has no error message:

14:24:34: daemon: productsadmin
runtime/debug.PrintStack()
    /Users/sunfmin/go/src/runtime/debug/stack.go:16 +0x22
github.com/theplant/aigle/vendor/github.com/qor/qor/utils.ExitWithMsg(0x4da820, 0xc4202005d0, 0xc420497d60, 0x2, 0x2)
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/vendor/github.com/qor/qor/utils/utils.go:175 +0x161
github.com/theplant/aigle/vendor/github.com/qor/qor/resource.(*Meta).Initialize(0xc4202d4e78, 0x0, 0x0)
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/vendor/github.com/qor/qor/resource/meta.go:210 +0x776
github.com/theplant/aigle/vendor/github.com/qor/exchange.(*Meta).updateMeta(0xc4202d4e70)
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/vendor/github.com/qor/exchange/meta.go:49 +0x135
github.com/theplant/aigle/vendor/github.com/qor/exchange.(*Resource).Meta(0xc420162f00, 0xc4202d4e70, 0xc4202d4dc0)
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/vendor/github.com/qor/exchange/exchange.go:56 +0x47
github.com/theplant/aigle/products/productsadmin/resources.init.1()
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/products/productsadmin/resources/exchange.go:14 +0x207
github.com/theplant/aigle/products/productsadmin/resources.init()
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/products/productsadmin/resources/worker.go:88 +0x60
main.init()
    /Users/sunfmin/gopkg/src/github.com/theplant/aigle/products/productsadmin/main.go:21 +0x3d
2016/10/05 14:24:34 Listening on :5000 with process id: 7765

example:

type Product struct {
    Code string `gorm:"primary_key"`
}

If you do, it gives this error:

func init() {
    ProductExchange = exchange.NewResource(&db.Product{}, exchange.Config{PrimaryField: "Code"})
    ProductExchange.Meta(&exchange.Meta{Name: "Price"})
}
@sunfmin
Copy link
Member Author

sunfmin commented Oct 5, 2016

the Price doesn't exists in models, should give better error message.

@jinzhu jinzhu removed their assignment Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants