jacomyal / domino.js

[deprecated] A JavaScript cascading controller for fast interactive Web interfaces prototyping.
https://jacomyal.github.io/domino.js
MIT License
54 stars 7 forks source link

Structure error message #34

Closed ZorGleH closed 9 years ago

ZorGleH commented 11 years ago

When you declare a new structure, if it embeds a structure that doesn't exist, you got the message: [domino.global] A structure requires a valid "structure" property describing the structure. It can be a valid structure or a function that test if an object matches the structure. The stack trace gives you the line of the structure declaration, but it could be useful to know the key and structure involved.

e.g.:

domino.struct.add({
  id: 'jacomyal',
  struct: {
    cruiseMode: 'unknownStruct'
  }
});

In this case, you'd like to know that the key which causes error is cruiseModeand the struct is 'unknownStruct', especially if you've got several complex structs.

jacomyal commented 11 years ago

That's right, gotta add a more specific error message... Also, just for information, you can use properties that do not exist yet using the proto attribute, as following:

domino.struct.add({
  id: 'ZorGleH',
  proto: ['unknownStruct'],
  struct: {
    errMsgNazi: 'unknownStruct'
  }
});

// Then, declare the "unknownStruct" structure:
domino.struct.add({
  id: 'unknownStruct',
  struct: {
    myAttr: 'number'
  }
});
ZorGleH commented 11 years ago

"errMsgNazi" T_T just trying to make the world better! Oops! Sounds even worse! Thanks for the "proto" trick ;)

jacomyal commented 9 years ago

Moved the issue to the new related repository typology.