Mobx-state-tree: [Feature Request] better error message for Error while converting...

Created on 10 Dec 2017  路  1Comment  路  Source: mobxjs/mobx-state-tree

Currently it is:

Error: [mobx-state-tree] Error while converting `[{"id":"537c1f4f-22c7-4f96-887a-454322aaa76b","createdAt":"...
at path "/0/properties" value `undefined` is not assignable to type: `Property[]` (Value is not an array), ...
at path "/6/properties" value `undefined` is not assignable to type: `Property[]` (Value is not an array), ...
    at fail (http://192.168.1.116:8080/index.js:22785:11)
    at typecheckPublic (http://192.168.1.116:8080/index.js:24298:9)
    at typecheck (http://192.168.1.116:8080/index.js:24283:5)
    at ArrayType../node_modules/mobx-state-tree/dist/mobx-state-tree.module.js.ArrayType.applySnapshot (http://192.168.1.116:8080/index.js:24746:9)
    at executeAction (http://192.168.1.116:8080/index.js:27375:19)
    at ArrayType.res (http://192.168.1.116:8080/index.js:27366:16)
    at http://192.168.1.116:8080/index.js:23827:31
    at executeAction (http://192.168.1.116:8080/index.js:27375:19)
    at res (http://192.168.1.116:8080/index.js:27366:16)
    at runMiddleWares (http://192.168.1.116:8080/index.js:23709:27)

but in reality:

image

I think there are some features I need:

  • shorten the data, maybe display it in an object, not in string
  • which action triggers the error?
  • which path in the tree is the data trying to apply to?
  • some empty lines make paths obvious

Most helpful comment

Pull requests are welcome :)

>All comments

Pull requests are welcome :)

Was this page helpful?
0 / 5 - 0 ratings