Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error feedback for unexpected value in constructLayoutEngine #136

Merged

Conversation

MathiasWP
Copy link
Contributor

@MathiasWP MathiasWP commented Jun 14, 2021

I managed to get a TypeError: Cannot read property 'base' of undefined when using the constructLayoutEngine function. Thought it would be nice to add a check which gives some helpful feedback for users in the future who may do the same mistake.

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request. This needs a test beyond typescript declaration tests. I'll see if I can push to your branch with the test.


if (!resolvedRoutes)
throw Error(
`unexpected value passed to the "routes"-attribute on constructLayoutEngine. Value was ${typeof resolvedRoutes}`
Copy link
Member

@joeldenning joeldenning Jun 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`unexpected value passed to the "routes"-attribute on constructLayoutEngine. Value was ${typeof resolvedRoutes}`
`single-spa-layout: constructLayoutEngine opts.routes must be provided. Value was ${typeof resolvedRoutes}`

Copy link
Member

@joeldenning joeldenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@joeldenning joeldenning merged commit deaa8ab into single-spa:main Jun 17, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants