Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated error property originalError #1341

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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