Skip to content

Commit 1a55b22

Browse files
committed
Revert "Merge pull request #1631 from marklogic/feature/update-error-message"
This reverts commit dd2e861.
1 parent 2f0aacf commit 1a55b22

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/impl/RowManagerImpl.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
import com.fasterxml.jackson.databind.JsonNode;
3434
import com.fasterxml.jackson.databind.ObjectMapper;
3535
import com.fasterxml.jackson.databind.node.JsonNodeType;
36-
import com.marklogic.client.*;
3736
import com.marklogic.client.DatabaseClientFactory.HandleFactoryRegistry;
37+
import com.marklogic.client.MarkLogicBindingException;
38+
import com.marklogic.client.MarkLogicIOException;
39+
import com.marklogic.client.MarkLogicInternalException;
40+
import com.marklogic.client.Transaction;
3841
import com.marklogic.client.document.DocumentWriteSet;
3942
import com.marklogic.client.expression.PlanBuilder;
4043
import com.marklogic.client.expression.PlanBuilder.Plan;
@@ -419,22 +422,11 @@ private RESTServiceResultIterator submitPlan(PlanBuilderBaseImpl.RequestPlan req
419422
AbstractWriteHandle astHandle = requestPlan.getHandle();
420423
List<ContentParam> contentParams = requestPlan.getContentParams();
421424
final String path = determinePath();
422-
try {
423-
if (contentParams != null && !contentParams.isEmpty()) {
424-
contentParams.add(new ContentParam(new PlanBuilderBaseImpl.PlanParamBase("query"), astHandle, null));
425-
return services.postMultipartForm(requestLogger, path, transaction, params, contentParams);
426-
}
427-
return services.postIteratedResource(requestLogger, path, transaction, params, astHandle);
428-
} catch (FailedRequestException ex) {
429-
String message = ex.getMessage();
430-
if (message != null && message.contains("RESTAPI-UPDATEFROMQUERY")) {
431-
String betterMessage = "The Optic plan is attempting an update but was sent to the wrong REST API endpoint. " +
432-
"You must invoke `withUpdate(true)` on the instance of com.marklogic.client.row.RowManager that you " +
433-
"are using to submit the plan";
434-
throw new FailedRequestException(betterMessage, ex.getFailedRequest());
435-
}
436-
throw ex;
437-
}
425+
if (contentParams != null && !contentParams.isEmpty()) {
426+
contentParams.add(new ContentParam(new PlanBuilderBaseImpl.PlanParamBase("query"), astHandle, null));
427+
return services.postMultipartForm(requestLogger, path, transaction, params, contentParams);
428+
}
429+
return services.postIteratedResource(requestLogger, path, transaction, params, astHandle);
438430
}
439431

440432
private PlanBuilderBaseImpl.RequestPlan checkPlan(Plan plan) {

marklogic-client-api/src/test/java/com/marklogic/client/test/rows/LockForUpdateTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,12 @@ public void basicTest() {
6969
@Test
7070
void wrongEndpoint() {
7171
rowManager.withUpdate(false);
72-
FailedRequestException ex = assertThrows(
72+
assertThrows(
7373
FailedRequestException.class,
7474
() -> rowManager.execute(op.fromDocUris("/optic/test/musician1.json").lockForUpdate()),
7575
"Hoping to update this assertion to verify that the server message tells the user to hit v1/rows/update " +
7676
"instead; right now, it's mentioning using declareUpdate() which isn't applicable to a REST API user."
7777
);
78-
79-
assertTrue(ex.getMessage().contains(
80-
"The Optic plan is attempting an update but was sent to the wrong REST API endpoint. " +
81-
"You must invoke `withUpdate(true)` on the instance of com.marklogic.client.row.RowManager " +
82-
"that you are using to submit the plan."),
83-
"Unexpected message: " + ex.getMessage());
8478
}
8579

8680
@Test

0 commit comments

Comments
 (0)