Skip to content

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

@sunfmin

Description

@sunfmin

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"})
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions