Commit Graph

4 Commits

Author SHA1 Message Date
Baptiste Manson
bad3ec4720 fix #1239 - Command-line based syntax errors now print location
Summary:
Hi all!

I took the path to implement a custom errorHandler, to be more aligned with the rest of the code, but it may be a mistake.

I reached that point.
```bash
echo "(){}" | yarn prepack
yarn prepack v0.27.5
$ node lib/prepack-cli.js
Unexpected token (1:1) found in stdin
Error: A fatal error occurred while prepacking.
+ (full stack trace)
error Command failed with exit code 1.
```

and when srcmapIn is given but not existing:
```bash
 echo "(){}" | yarn prepack -- --srcmapIn notExisting
yarn prepack v0.27.5
$ node lib/prepack-cli.js "--srcmapIn" "notExisting"
No sourcemap found at notExisting.
Unexpected token (1:1) found in stdin
+ (stack trace)
```
Finally when using files with syntax error:
```bash
yarn prepack ../notepad/test.js
yarn prepack v0.27.5
$ node lib/prepack-cli.js "../notepad/test.js"
Unexpected token (1:3) found in input file ../notepad/test.js
+ (stack trace)
```
Closes https://github.com/facebook/prepack/pull/1272

Differential Revision: D6595324

Pulled By: hermanventer

fbshipit-source-id: 6f73a15db5710585ffc9579f4487217a98f921f5
2017-12-18 13:56:26 -08:00
Chris Blappert
13f94fa1ba Change cli stdout output to stderr for exceptional cases
Summary:
When we catch an error in the cli and output it, we should be outputting to stderr and failing the prepack command.
Closes https://github.com/facebook/prepack/pull/1200

Reviewed By: hermanventer

Differential Revision: D6450152

Pulled By: cblappert

fbshipit-source-id: 9707ffe118b8740a36e3385998d7a71cf2c9471e
2017-11-30 12:55:59 -08:00
Chris Blappert
a8d935f27e Fixing output to look less like a failure on success
Summary:
running `yarn run test-std-in` no longer produces output ending in "Error: Fatal ..."
Closes https://github.com/facebook/prepack/pull/810

Differential Revision: D5420702

Pulled By: cblappert

fbshipit-source-id: 7628419dfb16597fef93a1a4b3bcb8f0d1fbd0bb
2017-07-13 16:53:40 -07:00
Sangboak Lee
1c23533c39 Change processSerializedCode func to receive error as 1st arg
Summary:
Since example code of [How to run Prepack](https://github.com/facebook/prepack#how-to-run-prepack) doesn't work(https://github.com/facebook/prepack/issues/781 )
I fixed `processSerializedCode` function to handle error as 1st argument
which follows 'error first callback' convention.
And to verify the changes I've added test code for the case of `StdIn`
Closes https://github.com/facebook/prepack/pull/784

Differential Revision: D5375275

Pulled By: NTillmann

fbshipit-source-id: ea85d0f30db4305aa7fcb5b69bf28f5998a84962
2017-07-06 12:39:48 -07:00