{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/577","repository_url":"https://api.github.com/repos/rollup/rollup","labels_url":"https://api.github.com/repos/rollup/rollup/issues/577/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/577/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/577/events","html_url":"https://github.com/rollup/rollup/issues/577","id":143998981,"number":577,"title":"Expose onError hook or allow Error config option","user":{"login":"nkoterba","id":2508944,"avatar_url":"https://avatars.githubusercontent.com/u/2508944?v=3","gravatar_id":"","url":"https://api.github.com/users/nkoterba","html_url":"https://github.com/nkoterba","followers_url":"https://api.github.com/users/nkoterba/followers","following_url":"https://api.github.com/users/nkoterba/following{/other_user}","gists_url":"https://api.github.com/users/nkoterba/gists{/gist_id}","starred_url":"https://api.github.com/users/nkoterba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkoterba/subscriptions","organizations_url":"https://api.github.com/users/nkoterba/orgs","repos_url":"https://api.github.com/users/nkoterba/repos","events_url":"https://api.github.com/users/nkoterba/events{/privacy}","received_events_url":"https://api.github.com/users/nkoterba/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-28T15:10:45Z","updated_at":"2016-03-28T18:00:32Z","closed_at":null,"body":"Hello -\r\n\r\nI'm trying to use rollup in a gulp pipeline:\r\n```javascript\r\ngulp.task('build', () => {\r\n\treturn gulp.src(mainJsFile)\r\n\t\t.on('error', handleErrors)\r\n\t\t.pipe(rollup({\r\n\t\t\tsourceMap : true,\r\n\t\t\tformat    : 'iife',\r\n\t\t\tmoduleName: 'defense'\r\n\t\t}))\r\n\t\t.pipe(babel())\r\n\t\t.pipe(rename(outputBundleName))\r\n\t\t.pipe(sourcemaps.write('.'))\r\n\t\t.pipe(gulp.dest(outputDir))\r\n\t\t.pipe(gulp.dest('../dist/defense'));\r\n})\r\n```\r\n\r\nI then am using `gulp-watch` (**not** the build-in gulp.watch), to provide live-reload of assets, etc.  However, if there's a syntax error in one of the files rollup is trying to process, I get the following stack trace:\r\n```javascript\r\nevents.js:141\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\nSyntaxError: Unexpected token (28:0) in code/src/directives/editable-list/editable-list.directive.es6.js\r\n    at Parser.pp$4.raise (code/node_modules/rollup/dist/rollup.js:4288:13)\r\n    at Parser.pp.unexpected (code/node_modules/rollup/dist/rollup.js:2744:8)\r\n    at Parser.pp$3.parseExprAtom (code/node_modules/rollup/dist/rollup.js:3891:12)\r\n    at Parser.pp$3.parseExprSubscripts (code/node_modules/rollup/dist/rollup.js:3780:19)\r\n    at Parser.pp$3.parseMaybeUnary (code/node_modules/rollup/dist/rollup.js:3761:19)\r\n    at Parser.pp$3.parseExprOps (code/node_modules/rollup/dist/rollup.js:3715:19)\r\n    at Parser.pp$3.parseMaybeConditional (code/node_modules/rollup/dist/rollup.js:3697:19)\r\n    at Parser.pp$3.parseMaybeAssign (code/node_modules/rollup/dist/rollup.js:3674:19)\r\n    at Parser.pp$3.parseExprList (code/node_modules/rollup/dist/rollup.js:4215:157)\r\n    at Parser.pp$3.parseExprAtom (code/node_modules/rollup/dist/rollup.js:3870:28)\r\n```\r\n\r\nIdeally, I would be able to handle the error from rollup, and not exit my `gulp watch` process so that I can fix the syntax error and continue with hot/live reload.\r\n\r\nIs this a planned future extension?  Am I missing something obvious now how to do this?"},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/202509837","html_url":"https://github.com/rollup/rollup/issues/577#issuecomment-202509837","issue_url":"https://api.github.com/repos/rollup/rollup/issues/577","id":202509837,"user":{"login":"TrySound","id":5635476,"avatar_url":"https://avatars.githubusercontent.com/u/5635476?v=3","gravatar_id":"","url":"https://api.github.com/users/TrySound","html_url":"https://github.com/TrySound","followers_url":"https://api.github.com/users/TrySound/followers","following_url":"https://api.github.com/users/TrySound/following{/other_user}","gists_url":"https://api.github.com/users/TrySound/gists{/gist_id}","starred_url":"https://api.github.com/users/TrySound/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrySound/subscriptions","organizations_url":"https://api.github.com/users/TrySound/orgs","repos_url":"https://api.github.com/users/TrySound/repos","events_url":"https://api.github.com/users/TrySound/events{/privacy}","received_events_url":"https://api.github.com/users/TrySound/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T18:00:32Z","updated_at":"2016-03-28T18:00:32Z","body":"@nkoterba About gulp3.*. You should catch every \"error ready\" pipe. And you need just pass native callback to error listener. The last pipe will be always catched. The problem is that errors do not bubble in the pipe. It was fixed in gulp4 which is not released yet, but I still use it.\r\n```js\r\ngulp.task('style', function (done) {\r\n  return gulp.src('src/main.css')\r\n    .pipe(postcss([some plugins]))\r\n    .on('error', done)\r\n    .pipe(gulp.dest('dist'));\r\n});\r\n```"}}