From 813b4ae21492062d65a8b6d55f41a77840c20e34 Mon Sep 17 00:00:00 2001 From: Daniel Flassak Date: Tue, 5 Dec 2023 16:05:50 +0100 Subject: [PATCH] add info about exceptions --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2da4430..d4e1d67 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ mdc(timeMachine, () -> { log.info("another message without context"); ``` -you can also return values: +You can also return values: ```java var currentTime = mdc(timeMachine, () -> { @@ -316,10 +316,11 @@ mdc(TimeMachineKey.class, timeMachine, () -> { You can also use try-with-resources to manage your MDC context if you prefer that or need to. -For example, the following code would ... +For example, the following code ... -1. ... not be possible with the callback API because `availableSeats` is not effectively final -1. ... be inconvenient, because there are multiple values in the MDC context, which would require nested callbacks +1. ... would not be possible with the callback API because `availableSeats` is not effectively final +1. ... would be inconvenient, because there are multiple values in the MDC context, which would require nested callbacks +1. ... may not be possible if `seat.isAvaliable()` can throw **multiple** checked Exceptions. The callback API works with one checked Exception, though. ```java int availableSeats = 0;