File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/java/com/marklogic/client/impl
test/java/com/marklogic/client/test Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -4229,7 +4229,7 @@ private Request.Builder setErrorFormatIfNecessary(Request.Builder requestBuilder
42294229 // server defaults to 'compatible'. If the error format is 'compatible', a block of HTML is sent back which
42304230 // causes an error that prevents the user from seeing the actual error from the server. So for all eval calls,
42314231 // X-Error-Accept is used to request any errors back as JSON so that they can be handled correctly.
4232- if ("eval" .equals (path )) {
4232+ if ("eval" .equals (path ) || ( "invoke" . equals ( path )) ) {
42334233 requestBuilder .addHeader (HEADER_ERROR_FORMAT , "application/json" );
42344234 }
42354235 return requestBuilder ;
Original file line number Diff line number Diff line change @@ -85,6 +85,20 @@ void invalidJavascript() {
8585 "https://docs.marklogic.com/guide/rest-dev/intro#id_34966; actual error: " + message );
8686 }
8787
88+ @ Test
89+ void invalidJavascriptModule () {
90+ FailedRequestException ex = assertThrows (FailedRequestException .class , () ->
91+ Common .evalClient .newServerEval ().modulePath ("/data/moduleDoesNotExist.sjs" ).eval ()
92+ );
93+ String message = ex .getServerMessage ();
94+ assertTrue (
95+ message .contains ("Module /data/moduleDoesNotExist.sjs not found" ),
96+ "The error message from the server is expected to contain the actual error, which in this case " +
97+ "is due to a missing module. In order for this to happen, the Java Client should send the " +
98+ "X-Error-Accept header per the docs at https://docs.marklogic.com/guide/rest-dev/intro#id_34966; " +
99+ "actual error: " + message );
100+ }
101+
88102 @ Test
89103 void invalidXQuery () {
90104 FailedRequestException ex = assertThrows (FailedRequestException .class , () ->
You can’t perform that action at this time.
0 commit comments