mirror of
https://github.com/less/less.js.git
synced 2026-01-10 08:08:19 -05:00
Fix expected response when there's a socket error (#3597)
In the case of a network issue, there's an error but no response, so no statusCode, This fixes it Fixes #3594
This commit is contained in:
committed by
GitHub
parent
3c23217358
commit
63c1827c63
@@ -27,8 +27,8 @@ UrlFileManager.prototype = Object.assign(new AbstractFileManager(), {
|
||||
const hackUrlStr = urlStr.indexOf('?') === -1 ? urlStr + '?' : urlStr
|
||||
|
||||
request.get(hackUrlStr, { follow_max: 5 }, (err, resp, body) => {
|
||||
if (err || resp.statusCode >= 400) {
|
||||
const message = resp.statusCode === 404
|
||||
if (err || resp && resp.statusCode >= 400) {
|
||||
const message = resp && resp.statusCode === 404
|
||||
? `resource '${urlStr}' was not found\n`
|
||||
: `resource '${urlStr}' gave this Error:\n ${err || resp.statusMessage || resp.statusCode}\n`;
|
||||
reject({ type: 'File', message });
|
||||
|
||||
Reference in New Issue
Block a user