Skip to content

Commit 19aaf6d

Browse files
committed
Added a message to PrestoException whenever there is a internal server error.
1 parent 139cade commit 19aaf6d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

metacat-hive-connector/src/main/java/com/netflix/metacat/hive/connector/BaseMetacatHiveMetastore.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void createDatabase(Database database){
6767
} catch (AlreadyExistsException e) {
6868
throw new SchemaAlreadyExistsException(database.getName(), e);
6969
} catch (Exception e) {
70-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
70+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error creating database", e);
7171
}
7272
}
7373

@@ -79,7 +79,7 @@ public void updateDatabase(Database database){
7979
} catch (MetaException | InvalidObjectException e) {
8080
throw new InvalidMetaException("Invalid metadata for " + database.getName(), e);
8181
} catch (Exception e) {
82-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
82+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error updating database", e);
8383
}
8484
}
8585

@@ -90,7 +90,7 @@ public void dropDatabase(String dbName) {
9090
catch (NoSuchObjectException e) {
9191
throw new SchemaNotFoundException(dbName);
9292
}catch (Exception e) {
93-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
93+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error dropping database", e);
9494
}
9595
}
9696

@@ -102,7 +102,7 @@ public void alterTable(final Table table) {
102102
} catch (AlreadyExistsException e) {
103103
throw new TableAlreadyExistsException(new SchemaTableName(table.getDbName(), table.getTableName()));
104104
} catch (Exception e) {
105-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
105+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error altering table", e);
106106
}
107107
}
108108

@@ -111,7 +111,7 @@ public List<Table> getTablesByNames(String dbName, List<String> tableNames) {
111111
try (HiveMetastoreClient client = clientProvider.createMetastoreClient()){
112112
return client.get_table_objects_by_name( dbName, tableNames);
113113
} catch (Exception e) {
114-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
114+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error fetching tables", e);
115115
}
116116
}
117117

@@ -121,7 +121,7 @@ public List<Partition> getPartitions(String dbName, String tableName, String fil
121121
} catch (NoSuchObjectException e) {
122122
throw new TableNotFoundException(new SchemaTableName(dbName, tableName), e);
123123
}catch (Exception e) {
124-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
124+
throw new PrestoException(HIVE_METASTORE_ERROR, String.format("Internal server error fetching partitions for table %s.%s", dbName, tableName), e);
125125
}
126126
}
127127

@@ -131,7 +131,7 @@ public List<Partition> getPartitions(String dbName, String tableName, List<Strin
131131
} catch (NoSuchObjectException e) {
132132
throw new TableNotFoundException(new SchemaTableName(dbName, tableName), e);
133133
}catch (Exception e) {
134-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
134+
throw new PrestoException(HIVE_METASTORE_ERROR, String.format("Internal server error fetching partitions for table %s.%s", dbName, tableName), e);
135135
}
136136
}
137137

@@ -145,7 +145,7 @@ public void addDropPartitions(String dbName, String tableName,
145145
} catch (MetaException | InvalidObjectException e) {
146146
throw new InvalidMetaException("One or more partitions are invalid.", e);
147147
} catch (Exception e) {
148-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
148+
throw new PrestoException(HIVE_METASTORE_ERROR, String.format("Internal server error adding/dropping partitions for table %s.%s", dbName, tableName), e);
149149
}
150150
}
151151

@@ -155,7 +155,7 @@ public void savePartitions(List<Partition> partitions) {
155155
} catch (MetaException | InvalidObjectException e) {
156156
throw new InvalidMetaException("One or more partitions are invalid.", e);
157157
} catch (Exception e) {
158-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
158+
throw new PrestoException(HIVE_METASTORE_ERROR, "Internal server error saving partitions", e);
159159
}
160160
}
161161

@@ -167,7 +167,7 @@ public void alterPartitions(String dbName, String tableName, List<Partition> par
167167
} catch (MetaException | InvalidObjectException e) {
168168
throw new InvalidMetaException("One or more partitions are invalid.", e);
169169
} catch (Exception e) {
170-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
170+
throw new PrestoException(HIVE_METASTORE_ERROR, String.format("Internal server error altering partitions for table %s.%s", dbName, tableName), e);
171171
}
172172
}
173173

@@ -177,7 +177,7 @@ public void dropPartitions( String dbName, String tableName, List<String> partit
177177
} catch (NoSuchObjectException e) {
178178
throw new TableNotFoundException(new SchemaTableName(dbName, tableName), e);
179179
}catch (Exception e) {
180-
throw new PrestoException(HIVE_METASTORE_ERROR, e);
180+
throw new PrestoException(HIVE_METASTORE_ERROR, String.format("Internal server error dropping partitions for table %s.%s", dbName, tableName), e);
181181
}
182182
}
183183

metacat-hive-connector/src/main/java/com/netflix/metacat/hive/connector/MetacatHiveMetastore.java

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public interface MetacatHiveMetastore extends HiveMetastore {
9292

9393
/**
9494
* Alter partitions.
95+
* @param dbName database name
96+
* @param tableName table name
9597
* @param partitions list of partitions
9698
* @throws NoSuchObjectException if the table does not exist
9799
*/

0 commit comments

Comments
 (0)