Skip to content

Commit

Permalink
Fix undefined for network error missing response
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jan 5, 2024
1 parent d0870a1 commit dbd7f79
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions w3c-html-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ const w3cHtmlValidator = {
const response = reason.response;
const getMsg = () => [response.status, response.res.statusMessage, response.request.url];
const message = response ? getMsg() : [reason.errno, reason.message];
response.body = { messages: [{ type: 'network-error', message: message.join(' ') }] };
return toValidatorResults(response);
const errRes = response ?? <ReasonError['response']>{};
errRes.body = { messages: [{ type: 'network-error', message: message.join(' ') }] };
return toValidatorResults(errRes);
};
return w3cRequest.then(filterMessages).then(toValidatorResults).catch(handleError);
},
Expand Down

0 comments on commit dbd7f79

Please sign in to comment.