From 864db22924b87e250d8073989ad80b4f872da549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andi=20Pa=CC=88tzold?= Date: Mon, 22 Apr 2024 22:44:57 +0200 Subject: [PATCH] fix: remove deleted strava segment "Watopia Sprint Rev." --- data/segments.mjs | 2 -- scripts/helpers/fetch-segments.mjs | 6 ++++++ src/segments.ts | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/segments.mjs b/data/segments.mjs index ac5c6e04..99376813 100644 --- a/data/segments.mjs +++ b/data/segments.mjs @@ -232,8 +232,6 @@ export const segments = [ slug: "watopia-sprint-rev", type: "sprint", world: "watopia", - stravaSegmentId: 12109228, - stravaSegmentUrl: "https://www.strava.com/segments/12109228", whatsOnZwiftUrl: "https://whatsonzwift.com/world/watopia/segment/sprint/reverse", distance: 0.2, diff --git a/scripts/helpers/fetch-segments.mjs b/scripts/helpers/fetch-segments.mjs index 24f6e9cf..03063eb1 100644 --- a/scripts/helpers/fetch-segments.mjs +++ b/scripts/helpers/fetch-segments.mjs @@ -11,6 +11,12 @@ export async function fetchSegments() { const url = `https://www.strava.com/stream/segments/${segment.stravaSegmentId}?streams%5B%5D=latlng&streams%5B%5D=distance`; const response = await fetch(url); const data = await response.json(); + if ("error" in data) { + throw new Error( + `Error fetching segment '${segment.stravaSegmentId}'`, + data.error + ); + } return { ...segment, latlng: data.latlng, diff --git a/src/segments.ts b/src/segments.ts index c1b3d875..b8167131 100644 --- a/src/segments.ts +++ b/src/segments.ts @@ -305,8 +305,8 @@ export const segments: ReadonlyArray = ( "https://whatsonzwift.com/world/watopia/segment/sprint/reverse", "watopia-sprint-reverse", "https://zwifterbikes.web.app/route/watopia-sprint-reverse", - 12109228, - "https://www.strava.com/segments/12109228", + undefined, + undefined, undefined, undefined, ],