Cannot patch Function
crymic opened this issue · comments
Foundry 0.7.7
5e 1.1.1
I am getting this on boot up of Foundry.
Cannot patch function. It has wrong content at line 9 : if ( (v !== null) && ( window[dtype] instanceof Function ) ) { != if ( (v !== null) && ( window[dtype] instanceof Function ) ) v = window[dtype](v);
toObject() {
const data = {};
for ( let [k, v] of this.entries() ) {
const dtype = this.dtypes[k];
if ( dtype === "Boolean" ) v = v === "true";
else if ( dtype === "JSON" ) v = JSON.parse(v);
else if ( (dtype === "String") && !v ) v = "";
else {
if ( v === "" ) v = null;
if ( (v !== null) && ( window[dtype] instanceof Function ) ) {
try {
v = window[dtype](v);
} catch(err) {
console.warn(`The form field ${k} was not able to be cast to the requested data type ${dtype}`);
}
}
}
data[k] = v;
}
return data;
}
Along with Mess causing this error.
foundry.js:2499 SyntaxError: Unexpected token 'function'
at Function (<anonymous>)
at s (modify-templates.js:88)
at index.js:56
at Function._call (foundry.js:2496)
at Function.callAll (foundry.js:2456)
at Game.initialize (eval at patchGame (main.js:7), <anonymous>:233:11)
at m.call_wrapper (wrapper.js:273)
at Game.<anonymous> (lib-wrapper.js:348)
at m.call_wrapper (wrapper.js:296)
at Game.fn (wrapper.js:18)
it points to.. => webpack:///./src/scripts/modify-templates.js
MeasuredTemplate.prototype.refresh = Function(
`"use strict"; return ( function ${newFun} )`
)();
Thanks.
That's not an issue, furnace is correctly reporting that it can't patch that function because its contents changed. More specifically, the patch that Furnace was going to apply has now been incorporated into the core, so there is nothing for it to do.
I will be removing the patch now though with the next update which will have 0.7.7 as minimum required version.