Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callbacks silently fail if callback isn't known (or implemented?) #903

Open
dogweather opened this issue Feb 9, 2018 · 3 comments
Open

Comments

@dogweather
Copy link

dogweather commented Feb 9, 2018

This silent failure makes callbacks very difficult to debug. With Guard/RSpec, this works:

  callback(:start_end) {
    `...`
  }

...but these seem to have no effect and give no error output:

  callback(:run_all_end) {
    `...`
  }
  callback(:xxxxxxx) {
    `...`
  }
@rymai
Copy link
Member

rymai commented Mar 3, 2018

That's because the hooks/callbacks system is very flexible and allows a plugin to call hook "xxxxxxx" and that would call your :xxxxxxx callback.

That being said, callback(:run_all_end) should work for plugins that define a #run_all method.

@dogweather
Copy link
Author

That being said, callback(:run_all_end) should work for plugins that define a #run_all method.

I'm skeptical about that aspect of the design too :-) It means that a user of a plugin must familiarize themselves with its implementation details.

@rymai
Copy link
Member

rymai commented Mar 4, 2018

I'm skeptical about that aspect of the design too :-) It means that a user of a plugin must familiarize themselves with its implementation details.

Yes that's the constraint for built-in hooks (https://github.com/guard/guard/wiki/Hooks-and-callbacks), but a plugin can also define custom hooks and document them, without the need for the user to know the implementation details (https://github.com/guard/guard/wiki/Hooks-and-callbacks#developers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@rymai @dogweather and others