Skip to content

Commit

Permalink
NullPointerException information lost (#174)
Browse files Browse the repository at this point in the history
The change brings extra logging to identify where the exception occurs. It changes the error log information.

Co-authored-by: stheppi <[email protected]>
Co-authored-by: Andrew Stevenson <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 516928d commit 91e9428
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ class Writer[SM <: FileMetadata](
def innerMessageWrite(writingState: Writing): Either[NonFatalCloudSinkError, Unit] =
writingState.formatWriter.write(messageDetail) match {
case Left(err: Throwable) =>
logger.error(err.getMessage)
logger.error(
s"An error occurred while writing using ${writingState.formatWriter.getClass.getSimpleName}. " +
s"Details: Topic-Partition: ${messageDetail.topic.value}-${messageDetail.partition}, " +
s"Offset: ${messageDetail.offset.value}, " +
s"Key: ${messageDetail.key}, " +
s"Value: ${messageDetail.value}, " +
s"Headers: ${messageDetail.headers}.",
err,
)
NonFatalCloudSinkError(err.getMessage, err.some).asLeft
case Right(_) =>
writeState =
Expand Down

0 comments on commit 91e9428

Please sign in to comment.