Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Handle errors in pull streams
This is a through stream that can ensure your source stream always ends normally, even when it returns an error. This is useful if you are combining several source streams with pull-many, and you want to keep the remaining streams open even if one of them errors.
$ npm install pull-catch
var test = require('tape')
var S = require('pull-stream')
var Catch = require('../')
test('catch errors', function (t) {
t.plan(2)
S(
S.error(new Error('test')),
Catch(function onErr (err) {
t.equal(err.message, 'test', 'should callback with error')
}),
S.collect(function (err, resp) {
t.error(err, 'should end the stream without error')
})
)
})
test('return false to pass error', function (t) {
t.plan(1)
S(
S.error(new Error('test')),
Catch(function (err) {
return false
}),
S.collect(function (err, res) {
t.equal(err.message, 'test', 'should pass error in stream')
})
)
})
test('return truthy to emit one event then end', function (t) {
t.plan(2)
S(
S.error(new Error('test')),
Catch(function (err) {
return 'test data'
}),
S.collect(function (err, res) {
t.error(err, 'should not end with error')
t.deepEqual(res, ['test data'], 'should emit one event')
})
)
})
test('callback is optional', function (t) {
t.plan(1)
S(
S.error(new Error('test')),
Catch(),
S.collect(function (err, res) {
t.error(err, 'should end stream without error')
})
)
})
FAQs
Catch errors in a pull stream
We found that pull-catch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.