Azure / Azure/azure-functions-java-worker

Catching uncaught exceptions by means of request hooks

Abierto
#273 0 comentarios 0 reacciones 0 asignados Ver en GitHub
needs-investigation New Feature reviewed
Lenguaje dominante
Java
Estrellas
103
Forks
74
Merge medio
4 d 8 h
PR fusionados (30 d)
2

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

El issue no especifica archivos, tests ni puntos de entrada del worker. Empieza localizando las rutas de ejecución de requests y manejo de excepciones del worker de Java; después, determina si ya existen hooks pre/post. Se considera terminado cuando se haya implementado un diseño acordado para los hooks o el manejo de excepciones y esté cubierto por tests.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, java, kotlin
Área
backend, cloud
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.