-
Notifications
You must be signed in to change notification settings - Fork 13
Description
What
The documentation for 'handling initialisation errors' within the 'Using createAll with your components' section of the docs implies that the onError callback will receive a context object which always includes component, element and config.
However, we return early in createAll if GOV.UK Frontend is not supported. If this happens and an onError callback is provided, the callback is called but the context object only contains component and config. This is because we are not yet in the context of on an individual element, so it makes no sense to include one.
Separately, we also call the onError callback from initAll if GOV.UK Frontend is not supported. In this case, we're not yet in the context of a specific component or element, so the context object only includes config.
This is arguably a different context as this part of the documentation deals with createAll, but we don't document how the onError callback works in the context of initAll.
I'm also not sure that it makes sense for this documentation to only exist within the 'Building your own JavaScript components', as it's also relevant for users who are only using our components but want to handle any errors that come from them.
Why
Our documentation should accurately reflect how things work, in a way that's easy for users to understand.
Who needs to know about this
Developers, tech writers
Done when
- The documentation covers the three different ways that the
onErrorcallback can be called - The documentation is in a logical place