component
component copied to clipboard
Keys of already started components for `::component/component-function-threw-exception`
::component/component-function-threw-exception
error is useful in that it provides the partially started system, the failed component and its key as well. It would be useful to also have a list of keys of components that have already been started.
My usecase is to stop all those components again before doing a fix and retrying.
Without knowing which components have been started already, the only workaround I found is to calculate the start order like component does internally and take-while
until the key has been reached.
Hi @lgrapenthin, thanks for your comment!
I generally recommend that component stop
functions be safe to call even on a component that has not been started. That way you can just call stop
on the system map attached to the exception to stop any components that were started.
Alternatively, each component could track if it has been started by assoc
ing a key in its start
method.
Your suggestion is still an interesting alternative. It would require update-system
to keep track of which keys it had started. I'm not sure if that's worth the extra complexity, given that there are other alternatives and a partially-started system is always an exceptional case. But I'll give it some more thought. Thanks!
Thank you for thoughtful comment. I'd add that it can be worth the extra complexity. User level solutions require more complexity and are more error prone and have to be implemented by users.