Skip to content

add onerror hook or something like that #1629

Closed

Description

@tunnckoCore

I'm strongly for onerror hook too. I think to use eslint plugin which i will configure to throw on style errors/warnings, so i want to see more clearly the output of the ESLint, not that the plugin is failed.

src/index.js → dest/bar.cjs.js, dest/bar.es.js...
error: 'foo' is assigned a value but never used (no-unused-vars) at src/index.js:3:7:
  1 | import add from './add.js'
  2 |
> 3 | const foo = 123
    |       ^
  4 | console.log(add({ a: 1, b: 2, c: 123 }))
  5 |


1 error found.
[!] (eslint plugin) Error: Errors were found
src/index.js
Error: Errors were found
    at error (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:185:14)
    at Object.error (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:9141:6)
    at promise.then.previous (/home/charlike/github/wooh/node_modules/rollup/dist/rollup.js:9150:32)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:611:11)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

error Command failed with exit code 1.
ERROR: "build:node" exited with 1

similar to #577

Activity

  1. TrySound commented on Sep 13, 2017

    @TrySound
    Member

    @charlike Isn't promise.catch what you need?

  2. tunnckoCore commented on Sep 13, 2017

    @tunnckoCore
    Author

    No. I want to mute plugin errors. I tried with the onwarn but it's logically that it is for plugin warnings and not plugin errors.

    edit: Exactly the whole problem is that the user dont have api to do that and to access errors that plugins throw.

  3. MikeKovarik commented on Oct 25, 2017

    @MikeKovarik

    +1. I was trying to create plugin that would catch errors and show toast notifications (like gulp-notify) and I have it functioning but I can't publish it as plugin because plugins have no way of hooking into errors, only warnings with onwarn. I currently have to use JS API directly and react to watcher events:

    watcher.on('event', e => {
        if (e.code == 'ERROR' || e.code === 'FATAL')
            showNotification(e.error)
    })
    

    Usecase: when rollup runs in --watch mode in minimized window since I don't want it to take up space on my screen but i also really need to instantly know when build goes wrong.

  4. tunnckoCore commented on Oct 25, 2017

    @tunnckoCore
    Author

    Yup, absolutely. It can't be done even with plugin, cuz we just don't have api for such thing :D

  5. MikeKovarik commented on Oct 26, 2017

    @MikeKovarik

    yup

  6. guybedford commented on Jun 6, 2018

    @guybedford
    Contributor

    A buildEnd hook taking an error argument has been added in #2208. Feedback welcome.

  7. MikeKovarik commented on Jun 12, 2018

    @MikeKovarik

    Works great. I was able to finally finish rollup-plugin-notify. Thank you @guybedford

  8. tunnckoCore commented on Jun 12, 2018

    @tunnckoCore
    Author

    @MikeKovarik that's cooool! :)

  9. lukastaegert commented on Jun 13, 2018

    @lukastaegert
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions