Skip to content

Commit fa05ebb

Browse files
authored
improve emterpreter error on bad file (#5354)
1 parent 8962495 commit fa05ebb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/emterpretify.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ def post_process_code(code):
991991

992992
js += ['''
993993
var bytecodeFile = Module['emterpreterFile'];
994-
assert(bytecodeFile instanceof ArrayBuffer, 'bad emterpreter file');
994+
assert(bytecodeFile instanceof ArrayBuffer, 'bad or missing emterpreter file. if you compiled to JS (and not HTML) make sure you set Module["emterpreterFile"]');
995995
var codeSize = %d;
996996
HEAPU8.set(new Uint8Array(bytecodeFile).subarray(0, codeSize), eb);
997997
assert(HEAPU8[eb] === %d);
@@ -1001,7 +1001,9 @@ def post_process_code(code):
10011001
var relocationsStart = (codeSize+3) >> 2;
10021002
var relocations = (new Uint32Array(bytecodeFile)).subarray(relocationsStart);
10031003
assert(relocations.length === %d);
1004-
if (relocations.length > 0) assert(relocations[0] === %d);
1004+
if (relocations.length > 0) {
1005+
assert(relocations[0] === %d);
1006+
}
10051007
''' % (len(all_code), all_code[0], all_code[1], all_code[2], all_code[3], len(relocations), relocations[0])]
10061008

10071009
else:

0 commit comments

Comments
 (0)