Aller au contenu

Log And Rethrow (ARCH8166)

Ce contenu n’est pas encore disponible dans votre langue.

Key kotlin.logging.log-and-rethrow · Severity warning · Category logging

Flags catch blocks that log the exception and then throw it again - it will be logged once more by whoever catches it next.

catch (e: IOException) { log.error("x", e); throw e }
catch (e: IOException) { throw UploadException("x", e) }

Either log or rethrow; wrap with context if the caller needs it.