Skip to content

Commit 0a90624

Browse files
authored
Coral-Service: Handle error message for local mode creation failure (#352)
1 parent 7c23b8d commit 0a90624

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

coral-service/src/main/java/com/linkedin/coral/coralservice/controller/TranslationControllerLocal.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ public ResponseEntity createInLocalMetastore(@RequestBody String statement) {
4444
.body("Only queries starting with \"CREATE DATABASE|TABLE|VIEW\" are accepted.\n");
4545
}
4646

47-
SessionState.start(conf);
48-
run(driver, statement);
47+
try {
48+
SessionState.start(conf);
49+
run(driver, statement);
50+
} catch (Throwable t) {
51+
final Throwable cause = t.getCause();
52+
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(cause == null ? t.getMessage() : cause.getMessage());
53+
}
4954

5055
return ResponseEntity.status(HttpStatus.OK).body("Creation successful\n");
5156
}

0 commit comments

Comments
 (0)