The error message was set to storage in iteration init, but it wasn't
looked up until at iteration deinit. Normally this wouldn't have been
a problem, except the generic attribute iteration code didn't know
about this failure at init time yet, so it added extra attributes
which were returned. Handling these extra attributes could have caused
other errors, which replaced the original error.
case HANDLE_IMAPC:
if (imapc_storage_attribute_cmd(box, GETMETADATA, type_flags,
DEPTH_INFINITY, prefix, NULL,
- iter->actx) < 0)
+ iter->actx) < 0) {
+ mail_storage_last_error_push(box->storage);
iter->failed = TRUE;
+ }
break;
case HANDLE_UNAVAILABLE:
break;
default:
+ mail_storage_last_error_push(box->storage);
iter->failed = TRUE;
break;
}
int ret;
if (iter->ictx != NULL)
ret = index_storage_attribute_iter_deinit(iter->ictx);
- else
- ret = iter->failed ? -1 : 0;
+ else if (!iter->failed)
+ ret = 0;
+ else {
+ mail_storage_last_error_pop(iter->iter.box->storage);
+ ret = -1;
+ }
imapc_storage_attribute_iter_destroy(&iter);
return ret;