Skip to content

Commit 5519611

Browse files
Include resource name in missing route path error
1 parent 2e82db5 commit 5519611

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib/blueprint.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,11 @@ const createResource = (
830830
schema: OpenapiSchema,
831831
routes: Route[],
832832
): Resource => {
833-
const routePath = validateRoutePath(schema['x-route-path'], routes)
833+
const routePath = validateRoutePath(
834+
schemaName,
835+
schema['x-route-path'],
836+
routes,
837+
)
834838

835839
return {
836840
resourceType: schemaName,
@@ -847,11 +851,12 @@ const createResource = (
847851
}
848852

849853
const validateRoutePath = (
854+
resourceName: string,
850855
routePath: string | undefined,
851856
routes: Route[],
852857
): string => {
853858
if (routePath == null || routePath.length === 0) {
854-
throw new Error('Missing route path')
859+
throw new Error(`Resource ${resourceName} is missing a route path`)
855860
}
856861
if (!routes.some((r) => r.path === routePath)) {
857862
throw new Error(`Route path ${routePath} not found in routes`)

0 commit comments

Comments
 (0)