Skip to content

Commit 737485e

Browse files
authored
Clean handling of js-optimizer.js failure (#9470)
Rather than display a backtrace show a clean error and exit.
1 parent c8a7f1c commit 737485e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/shared.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,10 @@ def opt_level_to_str(opt_level, shrink_level=0):
22452245
@staticmethod
22462246
def js_optimizer(filename, passes, debug=False, extra_info=None, output_filename=None, just_split=False, just_concat=False, extra_closure_args=[]):
22472247
from . import js_optimizer
2248-
ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat, extra_closure_args)
2248+
try:
2249+
ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat, extra_closure_args)
2250+
except subprocess.CalledProcessError as e:
2251+
exit_with_error("'%s' failed (%d)", ' '.join(e.cmd), e.returncode)
22492252
if output_filename:
22502253
safe_move(ret, output_filename)
22512254
ret = output_filename

0 commit comments

Comments
 (0)