Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change GRRequest delege method -(void)requestFailed: to -(void)requestFailed:originRequest: #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified GoldRaccoon/Sources/GRRequestsManager.h
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions GoldRaccoon/Sources/GRRequestsManager.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ - (void)requestCompleted:(GRRequest *)request
[self _processNextRequest];
}

- (void)requestFailed:(GRRequest *)request
- (void)requestFailed:(GRRequest *)request originRequest:(GRRequest *)originRequest
{
if ([self.delegate respondsToSelector:@selector(requestsManager:didFailRequest:withError:)]) {
NSError *error = [NSError errorWithDomain:@"com.albertodebortoli.goldraccoon" code:-1000 userInfo:@{@"message": request.error.message}];
[self.delegate requestsManager:self didFailRequest:request withError:error];
// [self.delegate requestsManager:self didFailRequest:request withError:error];
[self.delegate requestsManager:self didFailRequest:originRequest withError:error];
}

[self _processNextRequest];
Expand Down
Empty file modified GoldRaccoon/Sources/GRRequestsManagerProtocol.h
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions GoldRaccoon/Sources/Requests/GRCreateDirectoryRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (void)start
if ([self hostnameForRequest:self] == nil) {
self.error = [[GRError alloc] init];
self.error.errorCode = kGRFTPClientHostnameIsNil;
[self.delegate requestFailed:self];
[self.delegate requestFailed:self originRequest:self];
return;
}

Expand All @@ -68,9 +68,9 @@ - (void)requestCompleted:(GRRequest *)request
}


- (void)requestFailed:(GRRequest *)request
- (void)requestFailed:(GRRequest *)request originRequest:(GRRequest *)originRequest
{
[self.delegate requestFailed:request];
[self.delegate requestFailed:request originRequest:self];
}

- (BOOL)shouldOverwriteFile:(NSString *)filePath forRequest:(id<GRDataExchangeRequestProtocol>)request
Expand Down
2 changes: 1 addition & 1 deletion GoldRaccoon/Sources/Requests/GRRequestProtocol.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

@required
- (void)requestCompleted:(id<GRRequestProtocol>)request;
- (void)requestFailed:(id<GRRequestProtocol>)request;
- (void)requestFailed:(id<GRRequestProtocol>)request originRequest:(id<GRRequestProtocol>)originRequest;

@optional
- (void)percentCompleted:(float)percent forRequest:(id<GRRequestProtocol>)request;
Expand Down
4 changes: 2 additions & 2 deletions GoldRaccoon/Sources/Requests/GRUploadRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ - (void)requestCompleted:(GRRequest *)request
[self.streamInfo openWrite:self];
}

- (void)requestFailed:(GRRequest *)request
- (void)requestFailed:(GRRequest *)request originRequest:(GRRequest *)originRequest
{
[self.delegate requestFailed:request];
[self.delegate requestFailed:request originRequest:self];
}

- (BOOL)shouldOverwriteFile:(NSString *)filePath forRequest:(id<GRDataExchangeRequestProtocol>)request
Expand Down
Empty file modified GoldRaccoon/Sources/Utils/GRQueue.h
100644 → 100755
Empty file.
Empty file modified GoldRaccoon/Sources/Utils/GRQueue.m
100644 → 100755
Empty file.
14 changes: 7 additions & 7 deletions GoldRaccoon/Sources/Utils/GRStreamInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (void)openRead:(GRRequest *)request
if ([request.dataSource hostnameForRequest:request] == nil) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientHostnameIsNil;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
return;
}
Expand All @@ -63,7 +63,7 @@ - (void)openRead:(GRRequest *)request
if (self.readStream == nil) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientCantOpenStream;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
return;
}
Expand All @@ -77,7 +77,7 @@ - (void)openRead:(GRRequest *)request
if (!request.didOpenStream && request.error == nil) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientStreamTimedOut;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
}
});
Expand All @@ -88,7 +88,7 @@ - (void)openWrite:(GRRequest *)request
if ([request.dataSource hostnameForRequest:request] == nil) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientHostnameIsNil;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
return;
}
Expand All @@ -109,7 +109,7 @@ - (void)openWrite:(GRRequest *)request
if (!self.writeStream) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientCantOpenStream;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
return;
}
Expand All @@ -123,7 +123,7 @@ - (void)openWrite:(GRRequest *)request
if (!request.didOpenStream && (request.error == nil)) {
request.error = [[GRError alloc] init];
request.error.errorCode = kGRFTPClientStreamTimedOut;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
}
});
Expand Down Expand Up @@ -203,7 +203,7 @@ - (void)streamError:(GRRequest *)request errorCode:(enum GRErrorCodes)errorCode
{
request.error = [[GRError alloc] init];
request.error.errorCode = errorCode;
[request.delegate requestFailed:request];
[request.delegate requestFailed:request originRequest:request];
[request.streamInfo close:request];
}

Expand Down