Catch non string routes

This commit is contained in:
Sam Carlton 2022-05-17 16:09:12 -05:00
parent ac90bf1a24
commit 8234d61214

View file

@ -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('/')