Browse Source

handle errors emitted by rollup-watch (#712)

ghi-672
Rich-Harris 9 years ago
parent
commit
a085bdc93a
  1. 4
      bin/src/handleError.js
  2. 4
      bin/src/runRollup.js

4
bin/src/handleError.js

@ -42,7 +42,7 @@ const handlers = {
}
};
export default function handleError ( err ) {
export default function handleError ( err, recover ) {
const handler = handlers[ err && err.code ];
if ( handler ) {
@ -57,5 +57,5 @@ export default function handleError ( err ) {
stderr( `Type ${chalk.cyan( 'rollup --help' )} for help, or visit https://github.com/rollup/rollup/wiki` );
process.exit( 1 );
if ( !recover ) process.exit( 1 );
}

4
bin/src/runRollup.js

@ -152,6 +152,10 @@ function execute ( options, command ) {
stderr( 'bundled in ' + event.duration + 'ms. Watching for changes...' );
break;
case 'ERROR':
handleError( event.error, true );
break;
default:
stderr( 'unknown event', event );
}

Loading…
Cancel
Save