Enrich the AjaxFetchError message with the response status

This commit is contained in:
Kristján Oddsson 2023-08-24 07:40:03 +02:00 committed by Thijs Louisse
parent b2c8a8ab90
commit 54287eeff0

View file

@ -5,7 +5,7 @@ export class AjaxFetchError extends Error {
* @param {string|Object} [body] * @param {string|Object} [body]
*/ */
constructor(request, response, body) { constructor(request, response, body) {
super(`Fetch request to ${request.url} failed.`); super(`Fetch request to ${request.url} failed with status ${response.status} ${response.statusText}`);
this.name = 'AjaxFetchError'; this.name = 'AjaxFetchError';
this.request = request; this.request = request;
this.response = response; this.response = response;