Azure / Azure/azure-functions-java-worker
Catching uncaught exceptions by means of request hooks
- Langage dominant
- Java
- Étoiles
- 103
- Forks
- 74
- Merge moyen
- 4 j 8 h
- PR mergées (30 j)
- 2
Description
#### 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)
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
L’issue ne nomme aucun fichier, test ni point d’entrée du worker. Commencez par localiser les chemins d’exécution des requests et de gestion des exceptions du worker Java, puis déterminez si des hooks pre/post existent déjà ; le travail est terminé lorsqu’une conception convenue des hooks ou de la gestion des exceptions est implémentée et couverte par des tests.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- azure, java, kotlin
- Domaine
- backend, cloud
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100