refactor: debugging usage

This commit is contained in:
cha0s 2019-04-20 14:13:04 -05:00
parent 3905bd5f09
commit a7f1372df1
2 changed files with 7 additions and 3 deletions

View File

@ -1,9 +1,11 @@
import D from 'debug';
import {Globals} from './globals';
import {TraversalCompiler} from './traversal-compiler';
import {TypeMap} from './types';
const compiled = new Map();
const debug = D('@avocado:behavior:context');
class Context extends Map {
@ -62,7 +64,8 @@ class Context extends Map {
traverseOneStep(steps, node, step) {
if ('undefined' === typeof node) {
const rendered = this.renderStepsUntilNow(steps, step);
throw TypeError(`"${rendered}" is traversed through but undefined`);
debug(`"${rendered}" is traversed through but undefined`);
return;
}
switch (step.type) {
case 'key':
@ -86,7 +89,8 @@ class Context extends Map {
return node[step.key] = value.get(this);
case 'invoke':
const rendered = this.renderStepsUntilNow(steps, step);
throw new ReferenceError(`invalid assignment to function "${rendered}"`);
debug(`invalid assignment to function "${rendered}"`);
return;
}
});
}

View File

@ -9,7 +9,7 @@ import {Synchronized} from '@avocado/state';
import {hasTrait, lookupTrait} from './trait-registry';
const debug = D('@avocado/entity:traits');
const debug = D('@avocado:entity:traits');
function copyTraitProperties(from, to, instance) {
do {