Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit ed01aa2

Browse files
authored
Merge pull request #157 from marklogic-community/feature/153-tde-error
#153: Including the templateBatchInsert script in error message
2 parents 5216eb5 + c8bc5b7 commit ed01aa2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/com/marklogic/client/ext/schemasloader/impl/DefaultSchemasLoader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ private void loadTdeTemplatesViaBatchInsert(List<DocumentFile> tdeFiles) {
133133
try {
134134
schemasDatabaseClient.newServerEval().javascript(script.toString()).eval().close();
135135
} catch (Exception ex) {
136-
throw new RuntimeException("Unable to load and validate TDE templates via tde.templateBatchInsert; cause: " + ex.getMessage(), ex);
136+
throw new RuntimeException("Unable to load and validate TDE templates via tde.templateBatchInsert; " +
137+
"cause: " + ex.getMessage() + "; the following script can be run in Query Console against your content " +
138+
"database to see the TDE validation error:\n" + script, ex);
137139
}
138140
}
139141

src/test/java/com/marklogic/client/ext/schemasloader/impl/ValidateTdeTemplatesTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public void badJsonFile() {
3030
final String path = Paths.get("src", "test", "resources", "bad-schemas", "bad-json").toString();
3131
if (TdeUtil.templateBatchInsertSupported(client)) {
3232
RuntimeException ex = assertThrows(RuntimeException.class, () -> loader.loadSchemas(path));
33+
assertTrue(ex.getMessage().contains("the following script can be run in Query Console against your content " +
34+
"database to see the TDE validation error"), "Unexpected message: " + ex.getMessage());
3335
FailedRequestException fre = (FailedRequestException)ex.getCause();
3436
assertTrue(fre.getMessage().contains("failed to apply resource at eval: Internal Server Error"),
3537
"Unfortunately, the FailedRequestException does not capture why the tde.templateBatchInsert failed; " +
@@ -63,6 +65,8 @@ public void badXmlFile() {
6365
final String path = Paths.get("src", "test", "resources", "bad-schemas", "bad-xml").toString();
6466
if (TdeUtil.templateBatchInsertSupported(client)) {
6567
RuntimeException ex = assertThrows(RuntimeException.class, () -> loader.loadSchemas(path));
68+
assertTrue(ex.getMessage().contains("the following script can be run in Query Console against your content " +
69+
"database to see the TDE validation error"), "Unexpected message: " + ex.getMessage());
6670
FailedRequestException fre = (FailedRequestException)ex.getCause();
6771
assertTrue(fre.getMessage().contains("failed to apply resource at eval: Internal Server Error"),
6872
"Unfortunately, the FailedRequestException does not capture why the tde.templateBatchInsert failed; " +

0 commit comments

Comments
 (0)