From 2a33dc178106d35553e91460c113bab17549d047 Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:25:22 +0100 Subject: [PATCH] fix(*): Add error handling for no pokedex entries --- src/routes/mydex/+page.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/mydex/+page.svelte b/src/routes/mydex/+page.svelte index 564cd17..f67ef7f 100644 --- a/src/routes/mydex/+page.svelte +++ b/src/routes/mydex/+page.svelte @@ -32,7 +32,6 @@ } async function fetchCatchRecords() { - console.log('Fetching catch record data'); const response = await fetch('/api/catch-records'); if (!response.ok) { throw new Error('Failed to fetch catch record data'); @@ -53,6 +52,11 @@ personalNotes: '' })); + if (newCatchRecords.length === 0) { + alert('No pokedex entries to create catch records for'); + return; + } + const batchSize = 500; for (let i = 0; i < newCatchRecords.length; i += batchSize) { const batch = newCatchRecords.slice(i, i + batchSize);