You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "gerlowskija (via GitHub)" <gi...@apache.org> on 2026/03/04 19:24:51 UTC

Re: [PR] SOLR-17549: v2 SolrRequest/SolrResponse should throw exception on error [solr]

gerlowskija commented on code in PR #4183:
URL: https://github.com/apache/solr/pull/4183#discussion_r2885637872


##########
solr/core/src/test/org/apache/solr/handler/V2ApiIntegrationTest.java:
##########
@@ -257,6 +261,35 @@ public void testSelect() throws Exception {
     assertEquals(0, ((SolrDocumentList) v2Response.getResponse().get("response")).getNumFound());
   }
 
+  @Test
+  public void testV2ApiErrorHandling() throws Exception {
+    final var deleteRequest = new CollectionsApi.DeleteCollection("collection-does-not-exist");
+
+    // Test with "Http" client
+    final String baseUrl = cluster.getJettySolrRunner(0).getBaseUrl().toString();
+    try (var httpClient = new HttpJettySolrClient.Builder(baseUrl).build()) {
+      final var ex =
+          expectThrows(RemoteSolrException.class, () -> deleteRequest.process(httpClient));
+      assertRSECodeAndMessage(ex, 400, "Could not find collection", "collection-does-not-exist");
+    }
+
+    // Test with "Cloud" client
+    final var ex =
+        expectThrows(
+            RemoteSolrException.class, () -> deleteRequest.process(cluster.getSolrClient()));
+    assertRSECodeAndMessage(ex, 400, "Could not find collection", "collection-does-not-exist");
+  }
+
+  private void assertRSECodeAndMessage(

Review Comment:
   I'm a bit ambivalent testing that thing as we're kindof digging its grave with each JAX-RS migration.  Also - it was never subject to the problem this PR is addressing.
   
   But it probably is good to test it while it exists; done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org