@@ -32,6 +32,10 @@ - (id) initWithDatabase: (CouchDatabase*)db result: (id)result;
3232@end
3333
3434
35+ @interface CouchQuery ()
36+ @property (readwrite ,retain ) NSError *error;
37+ @end
38+
3539
3640@implementation CouchQuery
3741
@@ -143,12 +147,11 @@ - (CouchQueryEnumerator*) rowsIfChanged {
143147
144148
145149- (NSError *) operation : (RESTOperation*)op willCompleteWithError : (NSError *)error {
146- error = [super operation: op willCompleteWithError: error];
147- if (error) {
148- Warn (@" %@ failed with %@ " , self, error);
149- _error = [error retain ];
150- }
151- if (!error && op.httpStatus == 200 ) {
150+ self.error = [super operation: op willCompleteWithError: error];
151+ if (_error)
152+ Warn (@" %@ failed with %@ " , self, _error);
153+
154+ if (!_error && op.httpStatus == 200 ) {
152155 NSDictionary * result = $castIf (NSDictionary , op.responseBody .fromJSON );
153156 NSArray * rows = $castIf (NSArray , [result objectForKey: @" rows" ]);
154157 if (rows) {
@@ -157,13 +160,12 @@ - (NSError*) operation: (RESTOperation*)op willCompleteWithError: (NSError*)erro
157160 result: result] autorelease ];
158161 } else {
159162 Warn (@" Couldn't parse rows from CouchDB view response" );
160- error = [RESTOperation errorWithHTTPStatus: 502
163+ self. error = [RESTOperation errorWithHTTPStatus: 502
161164 message: @" Couldn't parse rows from CouchDB view response"
162165 URL: self .URL];
163- _error = [error retain ];
164166 }
165167 }
166- return error ;
168+ return _error ;
167169}
168170
169171
0 commit comments