StringWriter code = new StringWriter();
IOTools.copy(script, code);
JSSourceFile[] inputs = new JSSourceFile[] { JSSourceFile.fromCode(sourceName, code.toString()) };
Result res = compiler.compile(new JSSourceFile[0], inputs, options);
if (res.success) {
script = new StringReader(compiler.toSource());
} else {
StringBuilder msg = new StringBuilder("Handle me gracefully JS errors\n");
for (JSError error : res.errors) {
msg.append(error.sourceName).append(":").append(error.lineNumber).append(" ").append(error.description)
.append("\n");