From c01e4fb30de27bf04aa8f102e166ed5e211f91b6 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 22 May 2024 01:35:01 +0100 Subject: [PATCH] misc: appropriate log type, ternary operator to prevent errors --- src/features/misc/modals/ErrorBoundary.jsx | 2 +- src/features/quote/Quote.jsx | 4 ++-- src/features/weather/options/WeatherOptions.jsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/misc/modals/ErrorBoundary.jsx b/src/features/misc/modals/ErrorBoundary.jsx index 3e2b9b8a..5a08f06e 100644 --- a/src/features/misc/modals/ErrorBoundary.jsx +++ b/src/features/misc/modals/ErrorBoundary.jsx @@ -22,7 +22,7 @@ class ErrorBoundary extends PureComponent { * @returns An object with two properties: error and errorData. */ static getDerivedStateFromError(error) { - console.log(error); + console.error(error); variables.stats.postEvent('modal', 'Error occurred'); return { error: true, diff --git a/src/features/quote/Quote.jsx b/src/features/quote/Quote.jsx index e1af3cb3..f86e3ee7 100644 --- a/src/features/quote/Quote.jsx +++ b/src/features/quote/Quote.jsx @@ -160,10 +160,10 @@ class Quote extends PureComponent { '', ) || // talk page link (if applicable) is only removed for English 'Unknown'; - authorimglicense = `© ${photographer}. ${license.value}`; + authorimglicense = `© ${photographer}. ${license?.value}`; authorimglicense = authorimglicense.replace(/copyright\s/i, '').replace(/©\s©\s/, '© '); - if (license.value === 'Public domain') { + if (license?.value === 'Public domain') { authorimglicense = null; } else if (photographer.value === 'Unknown' || !photographer) { authorimglicense = null; diff --git a/src/features/weather/options/WeatherOptions.jsx b/src/features/weather/options/WeatherOptions.jsx index 59717201..f6c3bb73 100644 --- a/src/features/weather/options/WeatherOptions.jsx +++ b/src/features/weather/options/WeatherOptions.jsx @@ -87,7 +87,7 @@ class WeatherOptions extends PureComponent { }, (error) => { // firefox requires this 2nd function - console.log(error); + console.error(error); }, { enableHighAccuracy: true,