From 24c59dbd6ad477aa8e4f82a67931213db169ff6e Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 9 Oct 2025 18:18:25 +0800 Subject: [PATCH] Fix kinda invalid syntax for catch --- src/utils/date-time-format.js | 4 ++-- src/utils/dtf-locale.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/date-time-format.js b/src/utils/date-time-format.js index ee6c0b6e..71d633e0 100644 --- a/src/utils/date-time-format.js +++ b/src/utils/date-time-format.js @@ -22,7 +22,7 @@ export function refreshLocales() { const createLocale = mem((language, options = {}) => { try { return new Intl.Locale(language, options); - } catch { + } catch (e) { // Fallback to simple string splitting // May not work properly due to how complicated this is if (!language) return null; @@ -77,7 +77,7 @@ const _DateTimeFormat = (locale, opts) => { try { return new Intl.DateTimeFormat(matchedLocale, options); - } catch { + } catch (e) { return new Intl.DateTimeFormat(undefined, options); } }; diff --git a/src/utils/dtf-locale.js b/src/utils/dtf-locale.js index c247bc6e..30d6d15f 100644 --- a/src/utils/dtf-locale.js +++ b/src/utils/dtf-locale.js @@ -10,7 +10,7 @@ function _getDtfLocale() { const dtfLocale = new Intl.DateTimeFormat().resolvedOptions().locale; store.session.set(DTFLOCALE_CACHE_KEY, dtfLocale); return dtfLocale; - } catch { + } catch (e) { return null; } }