@@ -254,19 +254,19 @@ public void createTable(
254254 client .createTable (table );
255255 return null ;
256256 });
257-
258- // Create Lance dataset if data provided
259- if (data != null && data .length > 0 ) {
260- WriteParams writeParams =
261- new WriteParams .Builder ().withMode (WriteParams .WriteMode .CREATE ).build ();
262- Dataset .create (allocator , location , schema , writeParams );
263- }
264- } catch (TException | InterruptedException | RuntimeException e ) {
257+ } catch (TException | InterruptedException e ) {
265258 if (e instanceof InterruptedException ) {
266259 Thread .currentThread ().interrupt ();
267260 }
268- throw LanceNamespaceException .serviceUnavailable (
269- e .getMessage (), HiveMetaStoreError .getType (), "" , CommonUtil .formatCurrentStackTrace ());
261+ throw LanceNamespaceException .serverError (
262+ "Fail to create table: " + e .getMessage (), HiveMetaStoreError .getType (), id .idStringStyle (), CommonUtil .formatCurrentStackTrace ());
263+ }
264+
265+ // Create Lance dataset if data provided
266+ if (data != null && data .length > 0 ) {
267+ WriteParams writeParams =
268+ new WriteParams .Builder ().withMode (WriteParams .WriteMode .CREATE ).build ();
269+ Dataset .create (allocator , location , schema , writeParams );
270270 }
271271 }
272272
@@ -280,10 +280,10 @@ public String dropTable(ObjectIdentifier id) {
280280 try {
281281 Optional <Table > hmsTable = HiveUtil .getTable (clientPool , catalog , db , tableName );
282282 if (!hmsTable .isPresent ()) {
283- throw LanceNamespaceException .notFound (
283+ throw LanceNamespaceException .serverError (
284284 String .format ("Table %s.%s.%s does not exist" , catalog , db , tableName ),
285285 TableNotFound .getType (),
286- String . format ( "%s.%s.%s" , catalog , db , tableName ),
286+ id . idStringStyle ( ),
287287 CommonUtil .formatCurrentStackTrace ());
288288 }
289289
@@ -302,7 +302,7 @@ public String dropTable(ObjectIdentifier id) {
302302 Thread .currentThread ().interrupt ();
303303 }
304304 throw LanceNamespaceException .serviceUnavailable (
305- e .getMessage (), HiveMetaStoreError .getType (), "" , CommonUtil .formatCurrentStackTrace ());
305+ e .getMessage (), HiveMetaStoreError .getType (), id . idStringStyle () , CommonUtil .formatCurrentStackTrace ());
306306 }
307307 }
308308}
0 commit comments