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

Handling of not implemented services in when called within fragment #12

Open
strecph1SICKAG opened this issue Feb 7, 2023 · 1 comment
Assignees
Milestone

Comments

@strecph1SICKAG
Copy link

I have an arrangement which makes services available via expose().

code3

To access this service from the arrangement within my fragments, I have to implement this function in expose() again.
code4

I struggled with getting this communication to work in the beginning, as it was unclear to me why and how I have to (re-)implement functions within a fragment to call them from the "external" arrangement.
I have two recommendations for clarifying this design choice and making it more beginner friendly:

No. 1: Clearly stating the options and reasons to choose them could make it easier to understand conceptually

The re-implementation of external functionalities within the fragments expose() was decided upon to create a clear fallback strategy, when the external service is not available.
This re-implementation can

  • be empty, if the fragment does not have to be usable outside the context enabling the external functionality
  • resemble the full external functionality, to make the fragment independent and fully featured without any context
  • contain any other fallback functionality to be called of external service not available

No. 2: I think it would be very helpful for situations like this to get meaningful errors from collage as to why I can't access a function.
Errors like the following could lower the barrier to entry:

  • "Uncaught (in promise) collageError: api.services.ArrangementName.getHelloWorld is not a defined in the Collage API expose() initialization, see here: LINK TO DOKU"

Thanks :)

@WanjaTschuorSICKAG WanjaTschuorSICKAG self-assigned this Feb 8, 2023
@WanjaTschuorSICKAG WanjaTschuorSICKAG added this to the v0.3.0 milestone Feb 8, 2023
@WanjaTschuorSICKAG
Copy link
Collaborator

WanjaTschuorSICKAG commented Feb 8, 2023

Hi Philip,

Thanks a lot for your detailed description!
We will add errors for unimplemented services to the next feature version.

Please update to @collage/core, @sick-davinci/collage is no longer maintained.

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

2 participants