Skip to content

Commit 938032b

Browse files
AyoubElkairhorns
authored andcommitted
throw error if registered component is not found
1 parent 2eeead1 commit 938032b

File tree

1 file changed

+3
-0
lines changed
  • packages/fastify-renderer/src/node

1 file changed

+3
-0
lines changed

packages/fastify-renderer/src/node/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ const FastifyRenderer = fp<FastifyRendererOptions>(
7575
})
7676

7777
fastify.decorateReply('render', async function (this: FastifyReply, token: RegisteredRenderable, props: any) {
78+
if (!plugin.registeredComponents[token]) {
79+
throw new Error(`No RegisteredRenderable component was found for the provided token= ${token.toString()}`)
80+
}
7881
const request = this.request
7982
const renderableRoute: RenderableRoute = {
8083
...this.server[kRenderOptions],

0 commit comments

Comments
 (0)