@@ -28,7 +28,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse
28
28
import io .swagger .v3 .oas .annotations .tags .Tag
29
29
import org .apache .hive .service .rpc .thrift .{TGetInfoType , TProtocolVersion }
30
30
31
- import org .apache .kyuubi .Utils . error
31
+ import org .apache .kyuubi .Logging
32
32
import org .apache .kyuubi .events .KyuubiEvent
33
33
import org .apache .kyuubi .operation .OperationHandle
34
34
import org .apache .kyuubi .server .api .ApiRequestContext
@@ -37,7 +37,7 @@ import org.apache.kyuubi.session.SessionHandle.parseSessionHandle
37
37
38
38
@ Tag (name = " Session" )
39
39
@ Produces (Array (MediaType .APPLICATION_JSON ))
40
- private [v1] class SessionsResource extends ApiRequestContext {
40
+ private [v1] class SessionsResource extends ApiRequestContext with Logging {
41
41
42
42
@ ApiResponse (
43
43
responseCode = " 200" ,
@@ -162,8 +162,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
162
162
request.runAsync,
163
163
request.queryTimeout)
164
164
} catch {
165
- case NonFatal (_) =>
166
- throw new NotFoundException (s " Error executing statement " )
165
+ case NonFatal (e) =>
166
+ val errorMsg = " Error executing statement"
167
+ error(errorMsg, e)
168
+ throw new NotFoundException (errorMsg)
167
169
}
168
170
}
169
171
@@ -178,8 +180,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
178
180
try {
179
181
fe.be.getTypeInfo(parseSessionHandle(sessionHandleStr))
180
182
} catch {
181
- case NonFatal (_) =>
182
- throw new NotFoundException (s " Error getting type information " )
183
+ case NonFatal (e) =>
184
+ val errorMsg = " Error getting type information"
185
+ error(errorMsg, e)
186
+ throw new NotFoundException (errorMsg)
183
187
}
184
188
}
185
189
@@ -194,8 +198,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
194
198
try {
195
199
fe.be.getCatalogs(parseSessionHandle(sessionHandleStr))
196
200
} catch {
197
- case NonFatal (_) =>
198
- throw new NotFoundException (s " Error getting catalogs " )
201
+ case NonFatal (e) =>
202
+ val errorMsg = " Error getting catalogs"
203
+ error(errorMsg, e)
204
+ throw new NotFoundException (errorMsg)
199
205
}
200
206
}
201
207
@@ -218,7 +224,9 @@ private[v1] class SessionsResource extends ApiRequestContext {
218
224
operationHandle
219
225
} catch {
220
226
case NonFatal (e) =>
221
- throw new NotFoundException (s " Error getting schemas " , e)
227
+ val errorMsg = " Error getting schemas"
228
+ error(errorMsg, e)
229
+ throw new NotFoundException (errorMsg)
222
230
}
223
231
}
224
232
@@ -240,8 +248,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
240
248
request.tableName,
241
249
request.tableTypes)
242
250
} catch {
243
- case NonFatal (_) =>
244
- throw new NotFoundException (s " Error getting tables " )
251
+ case NonFatal (e) =>
252
+ val errorMsg = " Error getting tables"
253
+ error(errorMsg, e)
254
+ throw new NotFoundException (errorMsg)
245
255
}
246
256
}
247
257
@@ -256,8 +266,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
256
266
try {
257
267
fe.be.getTableTypes(parseSessionHandle(sessionHandleStr))
258
268
} catch {
259
- case NonFatal (_) =>
260
- throw new NotFoundException (s " Error getting table types " )
269
+ case NonFatal (e) =>
270
+ val errorMsg = " Error getting table types"
271
+ error(errorMsg, e)
272
+ throw new NotFoundException (errorMsg)
261
273
}
262
274
}
263
275
@@ -279,8 +291,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
279
291
request.tableName,
280
292
request.columnName)
281
293
} catch {
282
- case NonFatal (_) =>
283
- throw new NotFoundException (s " Error getting columns " )
294
+ case NonFatal (e) =>
295
+ val errorMsg = " Error getting columns"
296
+ error(errorMsg, e)
297
+ throw new NotFoundException (errorMsg)
284
298
}
285
299
}
286
300
@@ -301,8 +315,10 @@ private[v1] class SessionsResource extends ApiRequestContext {
301
315
request.schemaName,
302
316
request.functionName)
303
317
} catch {
304
- case NonFatal (_) =>
305
- throw new NotFoundException (s " Error getting functions " )
318
+ case NonFatal (e) =>
319
+ val errorMsg = " Error getting functions"
320
+ error(errorMsg, e)
321
+ throw new NotFoundException (errorMsg)
306
322
}
307
323
}
308
324
}
0 commit comments