stuartsierra / component

Managed lifecycle of stateful objects in Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error or Warn when dependencies are null

deaddowney opened this issue · comments

When dependencies are not available for a component, it will usually end in tears rather quickly. Can component detect these rather than having the failure occur downstream?

The start-system function will throw an exception if any of the declared dependencies of a component are missing when you try to start it.

What else could it do? If you forgot to declare a dependency, there's no way 'component' can tell.

When developing new components, I sometimes use assertions to make sure I didn't forget a dependency.

That sounds good enough for my purposes. The dependency framework should check the declared deps are there on startup. I think I ran into an issue with an subcomponent (not declared) being null, rather than something in declared in component.

Thanks