Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 3994dba

Browse files
committed
update error messages
1 parent c87cac5 commit 3994dba

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

ios/CodePush/CodePush.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
@property (copy) void (^progressCallback)(long long, long long);
7777
@property (copy) void (^doneCallback)(BOOL);
7878
@property (copy) void (^failCallback)(NSError *err);
79+
@property NSString *downloadUrl;
7980

8081
- (id)init:(NSString *)downloadFilePath
8182
operationQueue:(dispatch_queue_t)operationQueue

ios/CodePush/CodePushDownloadHandler.m

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ - (id)init:(NSString *)downloadFilePath
2020
return self;
2121
}
2222

23-
- (void)download:(NSString*)url {
23+
- (void)download:(NSString *)url {
24+
self.downloadUrl = url;
2425
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]
2526
cachePolicy:NSURLRequestUseProtocolCachePolicy
2627
timeoutInterval:60.0];
@@ -53,10 +54,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLRespon
5354
if (statusCode >= 400) {
5455
[self.outputFileStream close];
5556
[connection cancel];
56-
57-
NSError *err = [NSError errorWithDomain:@"http download error"
58-
code:statusCode
59-
userInfo:nil];
57+
NSError *err = [CodePushErrorUtils errorWithMessage:[NSString stringWithFormat: @"Received %ld response from %@", (long)statusCode, self.downloadUrl]];
6058
self.failCallback(err);
6159
return;
6260
}
@@ -113,13 +111,8 @@ - (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
113111

114112
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
115113
[self.outputFileStream close];
116-
117-
// MUST have received bytes from remote server. do not do this, we will get a 0 bytes file of download.zip in download directory,
118-
// the variable isZip is FALSE and download.zip will be renamed app.bundle that occurring by self.doneCallback(isZip) method.
119114
if (self.receivedContentLength < 1) {
120-
NSError *err = [NSError errorWithDomain:@"received nothing"
121-
code:-1
122-
userInfo:nil];
115+
NSError *err = [CodePushErrorUtils errorWithMessage:[NSString stringWithFormat:@"Received empty response from %@", self.downloadUrl]];
123116
self.failCallback(err);
124117
return;
125118
}

0 commit comments

Comments
 (0)