diff --git a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx
index b99d581983..c8d3822ae7 100644
--- a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx
+++ b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx
@@ -289,8 +289,7 @@ describe('collectLegacyRoutes', () => {
createRoutableExtension({
name: 'Test',
mountPoint: routeRef,
- component: () =>
- Promise.resolve(() => {
+ component: async () => () => {
const app = useApp();
return
plugins: {app.getPlugins().map(p => p.getId())}
;
}),
diff --git a/packages/core-compat-api/src/collectLegacyRoutes.tsx b/packages/core-compat-api/src/collectLegacyRoutes.tsx
index 847c0805cb..1217f9531d 100644
--- a/packages/core-compat-api/src/collectLegacyRoutes.tsx
+++ b/packages/core-compat-api/src/collectLegacyRoutes.tsx
@@ -173,7 +173,7 @@ export function collectLegacyRoutes(
(route: ReactNode) => {
// TODO(freben): Handle feature flag and permissions framework wrapper elements
if (!React.isValidElement(route) || route.type !== Route) {
- throw new Error('Invalid element has been detected.');
+ throw new Error(`Invalid element inside FlatRoutes, expected Route but found ${route.type}.`);
}
const routeElement = route.props.element;
const path: string | undefined = route.props.path;
@@ -187,7 +187,7 @@ export function collectLegacyRoutes(
);
if (path === undefined) {
throw new Error(
- ` element with invalid path has been detected. Please make sure to pass the path's props`,
+ `Route element inside FlatRoutes had no path prop value given`,
);
}
if (!plugin) {