diff --git a/editor.planx.uk/src/routes/index.tsx b/editor.planx.uk/src/routes/index.tsx index 9acce1e60f..cbcb28b0f5 100644 --- a/editor.planx.uk/src/routes/index.tsx +++ b/editor.planx.uk/src/routes/index.tsx @@ -1,3 +1,4 @@ +import { logger } from "airbrake"; import { lazy, map, mount, redirect, route } from "navi"; import * as React from "react"; @@ -58,7 +59,13 @@ const editorRoutes = mount({ const mountPayRoutes = () => map(async () => { - return lazy(() => import("./pay")); + try { + return lazy(() => import("./pay")); + } catch (error) { + console.log("ERROR MOUNTING PAY ROUTES"); + logger.notify(error); + throw Error(`error in pay mount: ${error}`); + } }); export default isPreviewOnlyDomain diff --git a/editor.planx.uk/src/routes/views/standalone.tsx b/editor.planx.uk/src/routes/views/standalone.tsx index 9169cde616..a906eb1113 100644 --- a/editor.planx.uk/src/routes/views/standalone.tsx +++ b/editor.planx.uk/src/routes/views/standalone.tsx @@ -1,3 +1,4 @@ +import { logger } from "airbrake"; import gql from "graphql-tag"; import { publicClient } from "lib/graphql"; import { NaviRequest, NotFoundError } from "navi"; @@ -19,27 +20,32 @@ interface StandaloneViewData { * Fetches all necessary data, and sets up layout for a standalone page */ const standaloneView = async (req: NaviRequest) => { - const flowSlug = req.params.flow.split(",")[0]; - const teamSlug = - req.params.team || (await getTeamFromDomain(window.location.hostname)); - const data = await fetchDataForStandaloneView(flowSlug, teamSlug); + try { + const flowSlug = req.params.flow.split(",")[0]; + const teamSlug = + req.params.team || (await getTeamFromDomain(window.location.hostname)); + const data = await fetchDataForStandaloneView(flowSlug, teamSlug); - const { - flows: [{ team, settings: flowSettings }], - globalSettings, - } = data; + const { + flows: [{ team, settings: flowSettings }], + globalSettings, + } = data; - const state = useStore.getState(); - state.setFlowNameFromSlug(flowSlug); - state.setGlobalSettings(globalSettings[0]); - state.setFlowSettings(flowSettings); - state.setTeam(team); + const state = useStore.getState(); + state.setFlowNameFromSlug(flowSlug); + state.setGlobalSettings(globalSettings[0]); + state.setFlowSettings(flowSettings); + state.setTeam(team); - return ( - - - - ); + return ( + + + + ); + } catch (error) { + console.log("ERROR IN STANDALONE VIEW: ", error); + logger.notify(error); + } }; const fetchDataForStandaloneView = async (