add a minify error example

This commit is contained in:
kzc 2017-05-19 01:39:09 -04:00 committed by GitHub
parent dee6c5dace
commit 750aedd5c8

View File

@ -329,6 +329,13 @@ console.log(result.warnings); // [ 'Dropping unused variable u [0:1,18]' ]
console.log(result.error); // runtime error, not defined in this case
```
An error example:
```javascript
var result = UglifyJS.minify({"foo.js" : "if (0) else console.log(1);"});
console.log(JSON.stringify(result.error));
// {"message":"Unexpected token: keyword (else)","filename":"foo.js","line":1,"col":7,"pos":7}
```
## Minify options
- `warnings` (default `false`) — pass `true` to return compressor warnings