@@ -19,21 +19,21 @@ import { GAME_REPO_URL, UI_GUIDE_NAME } from "./constants";
1919import { t } from " @transifex/native" ;
2020import { buildMetaDescription } from " ./seo" ;
2121import {
22- NIGHTLY_VERSION ,
23- STABLE_VERSION ,
2422 type BuildInfo ,
25- type InitialAppState ,
2623 buildUrl ,
2724 changeVersion ,
2825 getCurrentVersionSlug ,
29- getVersionedBasePath ,
3026 getUrlConfig ,
27+ getVersionedBasePath ,
3128 handleInternalNavigation ,
29+ type InitialAppState ,
3230 initializeRouting ,
3331 isSupportedType ,
3432 isSupportedVersion ,
3533 navigateTo ,
34+ NIGHTLY_VERSION ,
3635 page ,
36+ STABLE_VERSION ,
3737 updateQueryParam ,
3838 updateQueryParamNoReload ,
3939 updateSearchRoute ,
@@ -48,9 +48,10 @@ import CategoryGrid from "./CategoryGrid.svelte";
4848import Loading from " ./Loading.svelte" ;
4949import Spinner from " ./Spinner.svelte" ;
5050import { fade } from " svelte/transition" ;
51- import { isTesting , isNext , RUNNING_MODE } from " ./utils/env" ;
51+ import { isNext , isTesting , RUNNING_MODE } from " ./utils/env" ;
5252import MigoWarning from " ./MigoWarning.svelte" ;
5353import Notification , { notify } from " ./Notification.svelte" ;
54+ import RenderErrorFallback from " ./RenderErrorFallback.svelte" ;
5455
5556import { gameSingularName } from " ./i18n/gettext" ;
5657
@@ -492,6 +493,30 @@ function maybeFocusSearch(e: KeyboardEvent) {
492493 }
493494}
494495
496+ function onItemBoundaryError(boundaryError : unknown ): void {
497+ const error =
498+ boundaryError instanceof Error
499+ ? boundaryError
500+ : new Error (String (boundaryError ));
501+ const routeItem = $page .route .item ;
502+ metrics .count (" app.error.catch" , 1 , {
503+ type: routeItem ?.type ?? " shell" ,
504+ id: routeItem ?.id ?? " none" ,
505+ });
506+ const context = {
507+ route: {
508+ version: $page .route .version ,
509+ type: routeItem ?.type ,
510+ id: routeItem ?.id ,
511+ search: $page .route .search ,
512+ },
513+ };
514+ console .error (error , context );
515+ Sentry .captureException (error , {
516+ contexts: { context },
517+ });
518+ }
519+
495520/**
496521 * Returns the native name (endonym) of a language (e.g., "Deutsch" for "de").
497522 * Uses Intl.DisplayNames to auto-generate names without hardcoded lists.
@@ -603,7 +628,9 @@ let canonicalUrl = $derived(
603628 type =" button"
604629 class =" search-control-btn search-clear-button"
605630 tabindex =" -1"
606- aria-label ={t (" Clear search" , { _context: SEARCH_UI_CONTEXT })}
631+ aria-label ={t (" Clear search" , {
632+ _context: SEARCH_UI_CONTEXT ,
633+ })}
607634 onclick ={() => {
608635 search = " " ;
609636 handleSearchInput ();
@@ -678,11 +705,16 @@ let canonicalUrl = $derived(
678705 {#if item }
679706 {#if $data }
680707 {#key item }
681- {#if item .id }
682- <Thing {item } data ={$data } />
683- {:else }
684- <Catalog type ={item .type } data ={$data } />
685- {/if }
708+ <svelte:boundary onerror ={onItemBoundaryError }>
709+ {#if item .id }
710+ <Thing {item } data ={$data } />
711+ {:else }
712+ <Catalog type ={item .type } data ={$data } />
713+ {/if }
714+ {#snippet failed (e )}
715+ <RenderErrorFallback data ={$data } error ={e } {item } />
716+ {/ snippet }
717+ </svelte:boundary >
686718 {/ key }
687719 {:else }
688720 <Loading
@@ -766,7 +798,9 @@ let canonicalUrl = $derived(
766798 <div class =" specs-footer" >
767799 <div class =" footer-item" >
768800 <span class =" spec-label"
769- >{t (" Maintainer" , { _context: INTRO_DASHBOARD_CONTEXT })}:</span >
801+ >{t (" Maintainer" , {
802+ _context: INTRO_DASHBOARD_CONTEXT ,
803+ })}:</span >
770804 <a href =" https://github.com/ushkinaz" target =" _blank" >ushkinaz</a >
771805 </div >
772806 <div class =" footer-item" >
@@ -777,7 +811,9 @@ let canonicalUrl = $derived(
777811 </div >
778812 <div class =" footer-item" >
779813 <span class =" spec-label"
780- >{t (" Feedback" , { _context: INTRO_DASHBOARD_CONTEXT })}:</span >
814+ >{t (" Feedback" , {
815+ _context: INTRO_DASHBOARD_CONTEXT ,
816+ })}:</span >
781817 <a href =" https://discord.gg/XW7XhXuZ89" target =" _blank" >Discord</a >
782818 </div >
783819 </div >
0 commit comments