Open anicolao opened 9 years ago
Where/how were you trying to use the unrequired model when you got this exception? Thanks
DetailViews and any View which defines their model as a ModelProperty (including TableView) now provide improved error reporting.
I think I was in IDBDAO.js via EasyDAO.js. I got EasyDAO to report early to the console with
function init(args) {
+ if (args.model.getRuntimeProperties === undefined) {
+ console.warn("Undefined model '" + args.model + "' - add to requires");
+ }
but though the call in IDBDAO.js around line 65/66 was the culprit I didn't successfully get that code to report an error message. Rather than figure out why I chose to log this bug, as I'd solved my immediate issue.
If someone writes code that omits a requires to import a model, they will later get an inscrutable stack trace that says that model.getRuntimeProperties is undefined.
It is not even possible to set a breakpoint on the line and reload to see what model is the problem; the reader has to find the call buried in the stack trace that references the model name.
Instead, if getRuntimeProperties is undefined, the code should at least print out the name of the model that's undefined and suggest that the user has missed a requires statement. In a perfect universe, it would tell the author which model is missing the requires, too.