From 8234d6121445f3a5a40bf65c40c1df3a60f8d86f Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 17 May 2022 16:09:12 -0500 Subject: [PATCH] Catch non string routes --- helpers/app-derived.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helpers/app-derived.js b/helpers/app-derived.js index ba9f1ca..b1efffe 100644 --- a/helpers/app-derived.js +++ b/helpers/app-derived.js @@ -57,6 +57,12 @@ export function getVideoEndpoint ( video ) { } export function getRouteType ( routeString ) { + // Catch non-string routes + if ( typeof routeString !== 'string' ) { + console.warn( 'routeString is not a string', routeString ) + throw new Error('Route is not a string') + } + // Remove first slash and split by remaining // slashes to get first part of route const [ routeType ] = routeString.substring(1).split('/')