Azure / Azure/azure-functions-java-worker

Catching uncaught exceptions by means of request hooks

オープン
#273 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
needs-investigation New Feature reviewed
主要言語
Java
スター
103
フォーク
74
平均マージ
4日 8時間
マージ済み PR(30日)
2

説明

#### 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)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

この Issue では、ファイル、テスト、worker のエントリーポイントが指定されていません。まず Java worker のリクエスト実行パスと例外処理パスを特定し、次に pre/post hook がすでに存在するかどうかを確認してください。合意された hook または例外処理の設計が実装され、テストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, java, kotlin
領域
backend, cloud
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。