Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191
This commit is contained in:
14
scripts/_find_js_error.js
Normal file
14
scripts/_find_js_error.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const fs=require('fs');
|
||||
const path='chat/public/builder.js';
|
||||
const src=fs.readFileSync(path,'utf8');
|
||||
let lo=0,hi=src.length,mid;let lastGood=0;
|
||||
while(lo<hi){mid=Math.floor((lo+hi)/2);
|
||||
try{new Function(src.slice(0,mid)); lastGood=mid; lo=mid+1;}catch(e){hi=mid;}
|
||||
}
|
||||
const start=Math.max(0,lastGood-200), end=Math.min(src.length, lastGood+200);
|
||||
const context=src.slice(start,end);
|
||||
const before=src.slice(0,lastGood);
|
||||
const linesBefore=before.split('\n').length;
|
||||
console.log('approx failure at char index', lastGood, 'around line', linesBefore);
|
||||
console.log('---context---');
|
||||
console.log(context);
|
||||
Reference in New Issue
Block a user