From d150dae5d156416351312f25b06de0013ee0a95d Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 10 Nov 2020 12:52:54 +0200 Subject: fixes to timeline error handling --- src/services/timeline_fetcher/timeline_fetcher.service.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js') diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index 72ea4890..0fdc579d 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -52,9 +52,8 @@ const fetchAndUpdate = ({ return apiService.fetchTimeline(args) .then(response => { - if (response.error) { - store.dispatch('setErrorData', { value: response }) - return + if (response.errors) { + throw new Error(`${response.status} ${response.statusText}`) } const { data: statuses, pagination } = response @@ -63,7 +62,15 @@ const fetchAndUpdate = ({ } update({ store, statuses, timeline, showImmediately, userId, pagination }) return { statuses, pagination } - }, () => store.dispatch('setError', { value: true })) + }) + .catch((error) => { + store.dispatch('pushGlobalNotice', { + level: 'error', + messageKey: 'timeline.error', + messageArgs: [error.message], + timeout: 5000 + }) + }) } const startFetching = ({ timeline = 'friends', credentials, store, userId = false, tag = false }) => { -- cgit v1.2.3-70-g09d2 From 1d2ba946b6b81dc225d0eec21548a737ca2fac5e Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 10 Nov 2020 14:28:10 +0200 Subject: make notifications also use the popup errors, remove all error from status/notif state --- CHANGELOG.md | 4 ++++ src/components/notifications/notifications.vue | 7 ------- src/i18n/en.json | 1 + src/modules/statuses.js | 21 +-------------------- .../notifications_fetcher.service.js | 18 ++++++++++++++---- .../timeline_fetcher/timeline_fetcher.service.js | 3 --- test/unit/specs/components/user_profile.spec.js | 3 +-- 7 files changed, 21 insertions(+), 36 deletions(-) (limited to 'src/services/timeline_fetcher/timeline_fetcher.service.js') diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f14bc59..a6b62bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Fixed regression in react popup alignment and overflowing - Fixed the occasional bug where screen would scroll 1px when typing into a reply form +- Fixed timeline errors locking timelines + +### Changed +- Errors when fetching are now shown with popup errors instead of "Error fetching updates" in panel headers ## [2.2.0] - 2020-11-06 diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue index bd875cca..b976026e 100644 --- a/src/components/notifications/notifications.vue +++ b/src/components/notifications/notifications.vue @@ -15,13 +15,6 @@ class="badge badge-notification unseen-count" >{{ unseenCount }} -
- {{ $t('timeline.error_fetching') }} -