Skip to content

Commit f4419bf

Browse files
committed
Log Kafka consumer.close errors
1 parent b33b6ee commit f4419bf

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/kafka/lib/AbstractKafkaConsumer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto'
22
import { pipeline } from 'node:stream/promises'
33
import { setTimeout } from 'node:timers/promises'
44
import {
5-
InternalError,
5+
InternalError, isError,
66
resolveGlobalErrorLogObject,
77
stringValueSerializer,
88
type TransactionObservabilityManager,
@@ -239,8 +239,12 @@ export abstract class AbstractKafkaConsumer<
239239

240240
try {
241241
await this.consumer.close()
242-
} catch {
243-
// Ignoring errors at this stage
242+
} catch (err) {
243+
// Reporting error but not throwing further
244+
this.logger.warn(resolveGlobalErrorLogObject(err), 'Error while closing Kafka consumer')
245+
this.errorReporter.report({
246+
error: isError(err) ? err : new Error('Unknown error while closing Kafka consumer')
247+
})
244248
}
245249
this.consumer = undefined
246250
}

0 commit comments

Comments
 (0)