From 7c9e1664012e417bac131e6708adf98baaffbb9c Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Thu, 9 Feb 2023 20:31:21 +0100 Subject: [PATCH] Warn more instead of erroring (#4302) --- packages/@uppy/audio/src/Audio.jsx | 2 +- packages/@uppy/core/src/Uppy.js | 2 +- packages/@uppy/dashboard/src/Dashboard.jsx | 5 +---- packages/@uppy/screen-capture/src/ScreenCapture.jsx | 6 +++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/@uppy/audio/src/Audio.jsx b/packages/@uppy/audio/src/Audio.jsx index bce6ed0d9e..9e43c16a6d 100644 --- a/packages/@uppy/audio/src/Audio.jsx +++ b/packages/@uppy/audio/src/Audio.jsx @@ -215,7 +215,7 @@ export default class Audio extends UIPlugin { } catch (err) { // Logging the error, exept restrictions, which is handled in Core if (!err.isRestriction) { - this.uppy.log(err, 'error') + this.uppy.log(err, 'warning') } } } diff --git a/packages/@uppy/core/src/Uppy.js b/packages/@uppy/core/src/Uppy.js index 59388c81b3..b70d02fc49 100644 --- a/packages/@uppy/core/src/Uppy.js +++ b/packages/@uppy/core/src/Uppy.js @@ -372,7 +372,7 @@ class Uppy { this.emit('error', error) } this.info({ message, details }, 'error', this.opts.infoTimeout) - this.log(`${message} ${details}`.trim(), 'error') + this.log(error, 'warning') } validateRestrictions (file, files = this.getFiles()) { diff --git a/packages/@uppy/dashboard/src/Dashboard.jsx b/packages/@uppy/dashboard/src/Dashboard.jsx index fca44f4fe0..29e7c57076 100644 --- a/packages/@uppy/dashboard/src/Dashboard.jsx +++ b/packages/@uppy/dashboard/src/Dashboard.jsx @@ -407,11 +407,8 @@ export default class Dashboard extends UIPlugin { // Emits first event on initialization. this.resizeObserver = new ResizeObserver((entries) => { const uppyDashboardInnerEl = entries[0] - const { width, height } = uppyDashboardInnerEl.contentRect - this.uppy.log(`[Dashboard] resized: ${width} / ${height}`, 'debug') - this.setPluginState({ containerWidth: width, containerHeight: height, @@ -430,7 +427,7 @@ export default class Dashboard extends UIPlugin { // and it's not due to the modal being closed && !isModalAndClosed ) { - this.uppy.log("[Dashboard] resize event didn't fire on time: defaulted to mobile layout", 'debug') + this.uppy.log('[Dashboard] resize event didn’t fire on time: defaulted to mobile layout', 'warning') this.setPluginState({ areInsidesReadyToBeVisible: true, diff --git a/packages/@uppy/screen-capture/src/ScreenCapture.jsx b/packages/@uppy/screen-capture/src/ScreenCapture.jsx index 488bfd7d6f..42450ff4a4 100644 --- a/packages/@uppy/screen-capture/src/ScreenCapture.jsx +++ b/packages/@uppy/screen-capture/src/ScreenCapture.jsx @@ -85,7 +85,7 @@ export default class ScreenCapture extends UIPlugin { install () { if (!isScreenRecordingSupported()) { - this.uppy.log('Screen recorder access is not supported', 'error') + this.uppy.log('Screen recorder access is not supported', 'warning') return null } @@ -192,8 +192,8 @@ export default class ScreenCapture extends UIPlugin { .catch((err) => { if (err.name === 'NotAllowedError') { this.uppy.info(this.i18n('micDisabled'), 'error', 5000) + this.uppy.log(this.i18n('micDisabled'), 'warning') } - return false }) } @@ -316,7 +316,7 @@ export default class ScreenCapture extends UIPlugin { } catch (err) { // Logging the error, exept restrictions, which is handled in Core if (!err.isRestriction) { - this.uppy.log(err, 'error') + this.uppy.log(err, 'warning') } } }