FIX: displays popup error for any error (#23184)
In the past we were only intercepting 429 and 404; it's probably better to surface any error. There are already tests for the 404 and 429, I consider them enough for now.
This commit is contained in:
parent
89259205d6
commit
0afddca0b9
|
@ -55,7 +55,7 @@ export default class ChatMessagesLoader {
|
||||||
this.canLoadMoreFuture = result.meta.can_load_more_future;
|
this.canLoadMoreFuture = result.meta.can_load_more_future;
|
||||||
this.canLoadMorePast = result.meta.can_load_more_past;
|
this.canLoadMorePast = result.meta.can_load_more_past;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.#handleError(error);
|
popupAjaxError(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ export default class ChatMessagesLoader {
|
||||||
this.canLoadMorePast = result.meta.can_load_more_past;
|
this.canLoadMorePast = result.meta.can_load_more_past;
|
||||||
this.fetchedOnce = true;
|
this.fetchedOnce = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.#handleError(error);
|
popupAjaxError(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
@ -111,17 +111,4 @@ export default class ChatMessagesLoader {
|
||||||
? model.messagesManager.messages.find((message) => !message.staged)
|
? model.messagesManager.messages.find((message) => !message.staged)
|
||||||
: model.messagesManager.messages.findLast((message) => !message.staged);
|
: model.messagesManager.messages.findLast((message) => !message.staged);
|
||||||
}
|
}
|
||||||
|
|
||||||
#handleError(error) {
|
|
||||||
switch (error?.jqXHR?.status) {
|
|
||||||
case 429:
|
|
||||||
popupAjaxError(error);
|
|
||||||
break;
|
|
||||||
case 404:
|
|
||||||
popupAjaxError(error);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue