Skip to content

Commit

Permalink
Merge pull request #1341 from tulios/remove-originalerror
Browse files Browse the repository at this point in the history
Remove deprecated error property originalError
  • Loading branch information
Nevon authored May 3, 2022
2 parents 74f8c6a + 043b58c commit c834b54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/consumer/__tests__/errorRecovery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ describe('Consumer', () => {
const crashListener = jest.fn()
consumer2.on(consumer.events.CRASH, crashListener)

const originalError = new KafkaJSError(new Error('💣'), { retriable: true })
const retryError = new KafkaJSNumberOfRetriesExceeded(originalError, {
const cause = new KafkaJSError(new Error('💣'), { retriable: true })
const retryError = new KafkaJSNumberOfRetriesExceeded(cause, {
retryCount: 5,
retryTime: 10000,
cause: originalError,
cause,
})
const error = new KafkaJSNonRetriableError(retryError, { cause: originalError })
const error = new KafkaJSNonRetriableError(retryError, { cause })

await consumer2.connect()
await consumer2.subscribe({ topic: topicName, fromBeginning: true })
Expand Down
4 changes: 0 additions & 4 deletions src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class KafkaJSNonRetriableError extends KafkaJSError {
constructor(e, { cause } = {}) {
super(e, { retriable: false, cause })
this.name = 'KafkaJSNonRetriableError'
// Kept for backwards compatibility. Introduced in v1.16.0
this.originalError = e
}
}

Expand Down Expand Up @@ -52,8 +50,6 @@ class KafkaJSNumberOfRetriesExceeded extends KafkaJSNonRetriableError {
constructor(e, { retryCount, retryTime }) {
super(e, { cause: e })
this.stack = `${this.name}\n Caused by: ${e.stack}`
// Kept for backwards compatibility. Introduced in v1.16.0
this.originalError = e
this.retryCount = retryCount
this.retryTime = retryTime
this.name = 'KafkaJSNumberOfRetriesExceeded'
Expand Down
4 changes: 0 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1062,10 +1062,6 @@ export class KafkaJSOffsetOutOfRange extends KafkaJSProtocolError {

export class KafkaJSNumberOfRetriesExceeded extends KafkaJSNonRetriableError {
readonly stack: string
/**
* @deprecated Use `cause` instead
*/
readonly originalError: Error
readonly retryCount: number
readonly retryTime: number
constructor(e: Error | string, metadata?: KafkaJSNumberOfRetriesExceededMetadata)
Expand Down

0 comments on commit c834b54

Please sign in to comment.