Skip to content
iffsid edited this page Jul 2, 2015 · 4 revisions

Common error messages (and what they might mean)

Particularly unhelpful error messages

Syntax errors

See issue #124: Readable error messages for syntax errors

/Users/mht/webppl/node_modules/esprima/esprima.js:5446
            throw e;
                  ^
Error: Line 167: Unexpected identifier
    at createError (/Users/mht/webppl/node_modules/esprima/esprima.js:2327:21)
    at unexpectedTokenError (/Users/mht/webppl/node_modules/esprima/esprima.js:2402:13)
    at throwUnexpectedToken (/Users/mht/webppl/node_modules/esprima/esprima.js:2407:15)
    at expect (/Users/mht/webppl/node_modules/esprima/esprima.js:2425:13)
    at parseConditionalExpression (/Users/mht/webppl/node_modules/esprima/esprima.js:3562:13)
    at parseAssignmentExpression (/Users/mht/webppl/node_modules/esprima/esprima.js:3727:16)
    at isolateCoverGrammar (/Users/mht/webppl/node_modules/esprima/esprima.js:2565:18)
    at parseConditionalExpression (/Users/mht/webppl/node_modules/esprima/esprima.js:3563:25)
    at parseAssignmentExpression (/Users/mht/webppl/node_modules/esprima/esprima.js:3727:16)
    at isolateCoverGrammar (/Users/mht/webppl/node_modules/esprima/esprima.js:2565:18)
    at parseVariableDeclaration (/Users/mht/webppl/node_modules/esprima/esprima.js:3872:20)

Actual error: missing ":" (as part of a "x? y: z" chunk) on line 105


I'm not sure what this one means. I think I get an error because of inference (running the model once through doesn't throw an error).

{ type: 'VariableDeclaration',
  declarations: [ { type: 'VariableDeclarator', id: [Object], init: [Object] } ],
  kind: 'var' }
returnify

/Users/mht/webppl/src/syntax.js:20
    throw new Error(message);
          ^
Error: returnify
    at /Users/mht/webppl/src/syntax.js:20:11
    at loop (/Users/mht/webppl/src/syntax.js:47:14)
    at /Users/mht/webppl/src/syntax.js:51:16
    at Array.4 (/Users/mht/webppl/src/syntax.js:35:16)
    at loop (/Users/mht/webppl/src/syntax.js:50:24)
    at /Users/mht/webppl/src/syntax.js:51:16
    at Array.3 (/Users/mht/webppl/src/syntax.js:35:16)
    at loop (/Users/mht/webppl/src/syntax.js:50:24)
    at /Users/mht/webppl/src/syntax.js:51:16
    at Array.2 (/Users/mht/webppl/src/syntax.js:35:16)

This happens when the webppl code being run doesn't have a returnable object. If the last line of the program ended with

var foo = Enumerate(model, params);

then this error triggers. If it is modified so

var foo = Enumerate(model, params);
foo

it goes away.