Skip to content

Commit

Permalink
fix: propagate stream errors better
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Nov 25, 2022
1 parent 3ac41a1 commit 65a69f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/mongo.db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transform } from 'stream'
import { Transform } from 'node:stream'
import {
BaseCommonDB,
CommonDB,
Expand Down Expand Up @@ -245,6 +245,7 @@ export class MongoDB extends BaseCommonDB implements CommonDB {
.collection<ROW>(q.table)
.find(query, options) // eslint-disable-line unicorn/no-array-method-this-argument
.stream()
.on('error', err => transform.emit('error', err))
.pipe(transform)
})
.catch(err => transform.emit('error', err))
Expand Down
2 changes: 1 addition & 1 deletion src/test/paths.cnst.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'path'
import * as path from 'node:path'

export const projectDir = path.join(`${__dirname}/../..`)
export const tmpDir = `${projectDir}/tmp`

0 comments on commit 65a69f2

Please sign in to comment.