If a function's implementation creates a Javascript error, it would return as a compile error due to the `error` variable being shadowed internally by this try-catch. This commit fixes that, as well as clarifies the fixed error messages with "internal error".
Parsing is expensive, if the parse tree can be stored on the DB it can
save a lot of compute time, but mongo can't store Classes, so we
re-write without classes