Skip to content

Commit

Permalink
Merge branch 'feature/logging-handle-exceptions'
Browse files Browse the repository at this point in the history
  • Loading branch information
paulchen committed Dec 15, 2023
2 parents c900735 + cda0eac commit 10c39e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/kotlin/at/rueckgr/kotlin/rocketbot/util/Logging.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ fun Logging.logExceptions(lambda: Logging.() -> Any) {
logger().error("Exception occurred", e)
}
}

fun Logging.handleExceptions(function: () -> Unit) {
try {
function.invoke()
}
catch (e: Throwable) {
logger().error("Exception occurred: ", e)
}
}

0 comments on commit 10c39e8

Please sign in to comment.