diff options
| author | Shpuld Shpuldson <shp@cock.li> | 2020-11-10 12:52:54 +0200 |
|---|---|---|
| committer | Shpuld Shpuldson <shp@cock.li> | 2020-11-10 12:52:54 +0200 |
| commit | d150dae5d156416351312f25b06de0013ee0a95d (patch) | |
| tree | e26943937f83fc08fcc58a81500a47d04b4ee2d6 /src/services/timeline_fetcher | |
| parent | e6ca489d302fe4d1e9379067bbf1bbb02ed3e87b (diff) | |
fixes to timeline error handling
Diffstat (limited to 'src/services/timeline_fetcher')
| -rw-r--r-- | src/services/timeline_fetcher/timeline_fetcher.service.js | 15 |
1 files changed, 11 insertions, 4 deletions
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 }) => { |
