Umbraco.CMS.Backoffice
Umbraco.CMS.Backoffice copied to clipboard
Improve error messages from createRoutePathBuilder
I've been working on a routed modal inside a workspace where that have a route similar to this:
/section/{my-section}/workspace/products/{categoryId}
I use element()
in the workspace manifest to mount a element and I tried to add a routed modal to show products to this element but got a strange error when the route loaded:
I was calling the routeBuilder
with the productId parameter:
<li><a href=${this._routeBuilder?.({productId:'123'})??""}>Route 123</a></li>
turns out that I needed to pass the categoryId as well,
<li><a href=${this._routeBuilder?.({productId:'222',categoryId:'111'})??""}>Route 123</a></li>
The problem was that since categoryId was not provided this code blew up:
https://github.com/umbraco/Umbraco.CMS.Backoffice/blob/384e044b41b6155465132e6df872667b8e42a29b/src/packages/core/router/generate-route-path-builder.function.ts#L14
I'm thinking that maybe the error message could be improved here so that the function outputs more information about what it did not find - would have saved some debugging =D