Skip to content

Commit 0b90043

Browse files
committed
improve fetchArchive error handling
1 parent 0df3630 commit 0b90043

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Set watchPatterns within ionic.project config file
55
* Friendly EMFILE error when too many files are watched
66
* Ensure config.xml content[src] gets reset after run/emulate
7+
* Improve fetchArchive error handling
78

89

910
### 1.2.4

lib/ionic.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,18 @@ Ionic = {
599599
var proxy = process.env.PROXY || null;
600600
var request = require('request');
601601
request({ url: archiveUrl, encoding: null, proxy: proxy }, function(err, res, body) {
602-
if(!res || res.statusCode !== 200) {
603-
console.error('Unable to fetch:'.error.bold, archiveUrl, '(' + res.statusCode + ')');
602+
if(err) {
603+
console.error('Error fetching:'.error.bold, archiveUrl, err);
604+
q.reject(err);
605+
return;
606+
}
607+
if(!res) {
608+
console.error('Invalid response:'.error.bold, archiveUrl);
609+
q.reject('Unable to fetch response: ' + archiveUrl);
610+
return;
611+
}
612+
if(res.statusCode !== 200) {
613+
console.error('Invalid response status:'.error.bold, archiveUrl, '(' + res.statusCode + ')');
604614
q.reject(res);
605615
return;
606616
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic",
3-
"version": "1.2.5-beta1",
3+
"version": "1.2.5-beta2",
44
"preferGlobal": true,
55
"description": "A tool for creating and developing Ionic Framework mobile apps.",
66
"homepage": "http://ionicframework.com/",

0 commit comments

Comments
 (0)