mirror of https://github.com/docker/docs.git
Adding errors for non-200 api responses
This commit is contained in:
parent
71985eaf0f
commit
c43a8d5a69
|
@ -80,7 +80,11 @@ module.exports = {
|
||||||
data.is_recommended = true;
|
data.is_recommended = true;
|
||||||
_.extend(data, repo);
|
_.extend(data, repo);
|
||||||
cb(null, data);
|
cb(null, data);
|
||||||
|
} else {
|
||||||
|
repositoryServerActions.error({error: new Error('Could not fetch repository information from Docker Hub.')});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}, (error, repos) => {
|
}, (error, repos) => {
|
||||||
repositoryServerActions.recommendedUpdated({repos});
|
repositoryServerActions.recommendedUpdated({repos});
|
||||||
|
@ -135,6 +139,11 @@ module.exports = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.statusCode !== 200) {
|
||||||
|
repositoryServerActions.error({error: new Error('Could not fetch repository information from Docker Hub.')});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let data = JSON.parse(body);
|
let data = JSON.parse(body);
|
||||||
cb(null, data.results);
|
cb(null, data.results);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue