diff --git a/packages/react/src/components/withPathBasedRouting.tsx b/packages/react/src/components/withPathBasedRouting.tsx index 1eaede62048..d3aae4f4550 100644 --- a/packages/react/src/components/withPathBasedRouting.tsx +++ b/packages/react/src/components/withPathBasedRouting.tsx @@ -2,11 +2,13 @@ import type { RoutingOptions } from '@clerk/types'; import type { ComponentProps, ComponentType } from 'react'; import React from 'react'; +import { errorThrower } from '../utils/errorThrower'; + export function withPathDefaultRouting(Component: T): T { const BaseComponent = Component as ComponentType; const HOC = (props: ComponentProps>) => { if (!props.path && !props.routing) { - throw new Error('Clerk: You must specify path and routing props'); + errorThrower.throw('You must specify path and routing props'); } if (props.path) { @@ -24,7 +26,6 @@ export function withPathDefaultRouting(Component: T HOC.displayName = BaseComponent.displayName; return Object.assign(HOC, { - displayName: BaseComponent.displayName, ...BaseComponent, - }) as unknown as T; + }) as T; }