SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

One bad RequestHook disables them all #182

Closed visualist closed 7 years ago

visualist commented 7 years ago

If you have one working RequestHook, like this in your config file:

    - group: hooks
      interface: org.restheart.hal.metadata.singletons.Hook
      singletons:
        - name: snooper
          class: org.restheart.hal.metadata.singletons.SnooperHook

and say it works fine. But when a second hook is added that is not a loadable class, then the previously working hook stops working. Example:

        - name: dnx
          class: org.organization.DoesNotExist

I should think only 'snooper' should continue to work in this case, just 'dnx' should fail. (This issue is more of an edge case & low priority for me, but wanted to report it just the same.)

mkjsix commented 7 years ago

I think it could be fixed with a different exception handling strategy when loading hooks, we should have a look at the code within RESTHeart. BTW, did you see the problem at startup time or at runtime?

visualist commented 7 years ago

It was at runtime when the working hook stopped working. Adjusting the exception handling makes sense.

visualist commented 7 years ago

FYI - When trying to use the working hook while the non-working one is also in the config file, I see this in the log:

11:18:30.649 [XNIO-1 task-1] DEBUG o.r.h.m.s.NamedSingletonsFactory - added singleton snooper of class org.restheart.hal.metadata.singletons.SnooperHook to group hooks

visualist commented 7 years ago

oops, didn't mean to close the issue

ujibang commented 7 years ago

Hi, news about this. Last commit should fix this issue.

Feel free to reopen. Thanks