Skip to content
Merged
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
11 changes: 8 additions & 3 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,14 @@ pub unsafe extern "C-unwind" fn request_cluster_scan(
Ok(existing_cursor) => existing_cursor,
Err(_error) => {
unsafe {
(core.failure_callback)(
report_error(
core.failure_callback,
callback_index,
format!("Invalid cursor ID: {}", cursor_id).as_ptr() as *const c_char,
format!("Invalid cursor ID: {}", cursor_id),
RequestErrorType::Unspecified,
);
}
panic_guard.panicked = false;
return;
}
}
Expand All @@ -504,7 +506,10 @@ pub unsafe extern "C-unwind" fn request_cluster_scan(
)
} {
Some(args) => args,
None => return,
None => {
panic_guard.panicked = false;
return;
}
};

// Run cluster scan.
Expand Down
12 changes: 6 additions & 6 deletions tests/Valkey.Glide.IntegrationTests/ScanTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ public async Task TestScanAsync_CombinedOptions(BaseClient client)
[Fact]
public async Task TestScanAsync_InvalidCursorId()
{
var standaloneClient = TestConfiguration.DefaultStandaloneClient();
var exception = await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(async () =>
using var standaloneClient = TestConfiguration.DefaultStandaloneClient();
await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(() =>
{
await standaloneClient.ScanAsync("invalid");
return standaloneClient.ScanAsync("invalid");
});

var clusterClient = TestConfiguration.DefaultClusterClient();
exception = await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(async () =>
using var clusterClient = TestConfiguration.DefaultClusterClient();
await Assert.ThrowsAsync<Valkey.Glide.Errors.RequestException>(() =>
{
await clusterClient.ScanAsync(new ClusterScanCursor("invalid"));
return clusterClient.ScanAsync(new ClusterScanCursor("invalid"));
});
}

Expand Down
Loading