Azure / Azure/azure-functions-java-worker
Catching uncaught exceptions by means of request hooks
- Ngôn ngữ chính
- Java
- Star
- 103
- Fork
- 74
- Merge trung bình
- 4 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 2
Mô tả
#### Investigative information
My question is two-folded:
1) I would like to know if there is a notion of pre-execution and post-execution hooks, meaning:
when a function is invoked, are there hooks exposed that will be called _before and after_ the function handler is invoked?
2) Is there a way by means of a _post-hook_ to catch uncaught exceptions? If not, what alternative can I use, (for example: an Exception Listener)?
#### Repro steps
For example, if I have a function handler like below (which is written in Kotlin), what abilities can I utilise to catch an exception if one occurs, that is not explicitly caught by a try/catch block?
```kotlin
class Function {
fun foobar(name: String?, context: ExecutionContext): String {
// mimicking an uncaught exception
throw Exception()
return "Foobar"
}
}
```
#### Expected behavior
A post-hook interface that creates the ability to implement the interface and define behaviour of pre/post-execution and on exception behaviour, for example:
```kotlin
interface PostExecutionRequestHandler {
fun onException(exception: ExecutionException)
}
```
Copied from original issue: [Azure/azure-functions-java-library#82](https://github.com/Azure/azure-functions-java-library/issues/82)
Hướng dẫn đóng góp
Hướng nghiên cứu
Issue không nêu tên file, test hoặc các entry point của worker. Trước tiên, hãy xác định các luồng thực thi request và xử lý exception của Java worker, sau đó xác định xem các pre/post hook đã tồn tại hay chưa; công việc được xem là hoàn tất khi một thiết kế hook hoặc xử lý exception đã được thống nhất được triển khai và có test bao phủ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, java, kotlin
- Lĩnh vực
- backend, cloud
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100