Make errors and their messages more accurate and helpful (#2536)
Also, I normalized them to all be sentences for consistency, and I moved the reentrancy check from `m.mount` to `m.render` to be a little more helpful. The router change during mounting is inconsequential and only to avoid the new modified error, and the change to the update loop is to send the original error if an error occurred while initializing the default route. (This is all around more useful anyways.) And while I was at it, I fixed an obscure bug with sync redraws.
This commit is contained in:
parent
475747800a
commit
b98ab29efd
14 changed files with 310 additions and 54 deletions
|
|
@ -18,7 +18,11 @@ Vnode.normalizeChildren = function(input) {
|
|||
// it, noticeably so.
|
||||
for (var i = 1; i < input.length; i++) {
|
||||
if ((input[i] != null && input[i].key != null) !== isKeyed) {
|
||||
throw new TypeError("Vnodes must either always have keys or never have keys!")
|
||||
throw new TypeError(
|
||||
isKeyed && (input[i] != null || typeof input[i] === "boolean")
|
||||
? "In fragments, vnodes must either all have keys or none have keys. You may wish to consider using an explicit keyed empty fragment, m.fragment({key: ...}), instead of a hole."
|
||||
: "In fragments, vnodes must either all have keys or none have keys."
|
||||
)
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue