{"id":20181729,"url":"https://github.com/nichoth/pull-catch","last_synced_at":"2025-06-18T09:37:14.558Z","repository":{"id":13674616,"uuid":"74855149","full_name":"nichoth/pull-catch","owner":"nichoth","description":"Catch errors in a pull stream","archived":false,"fork":false,"pushed_at":"2023-10-27T19:59:40.000Z","size":18,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-11T18:17:41.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/nichoth/pull-catch#readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nichoth.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-26T22:57:48.000Z","updated_at":"2023-11-17T13:03:08.000Z","dependencies_parsed_at":"2024-06-18T22:44:10.178Z","dependency_job_id":"a65bcc37-0866-4f91-b084-4423efc0c0a7","html_url":"https://github.com/nichoth/pull-catch","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"55ca93c84d404203d3df3b8de09ea26946a55616"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nichoth/pull-catch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fpull-catch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fpull-catch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fpull-catch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fpull-catch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichoth","download_url":"https://codeload.github.com/nichoth/pull-catch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fpull-catch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260079514,"owners_count":22955709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T02:36:32.217Z","updated_at":"2025-06-18T09:37:09.536Z","avatar_url":"https://github.com/nichoth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pull catch\nHandle errors in pull streams\n\nThis 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. \n\n## install \n\n    $ npm install pull-catch\n\n## example\n\n```js\nvar test = require('tape')\nvar S = require('pull-stream')\nvar Catch = require('../')\n\ntest('catch errors', function (t) {\n    t.plan(2)\n    S(\n        S.error(new Error('test')),\n        Catch(function onErr (err) {\n            t.equal(err.message, 'test', 'should callback with error')\n        }),\n        S.collect(function (err, resp) {\n            t.error(err, 'should end the stream without error')\n        })\n    )\n})\n\ntest('return false to pass error', function (t) {\n    t.plan(1)\n    S(\n        S.error(new Error('test')),\n        Catch(function (err) {\n            return false\n        }),\n        S.collect(function (err, res) {\n            t.equal(err.message, 'test', 'should pass error in stream')\n        })\n    )\n})\n\ntest('return truthy to emit one event then end', function (t) {\n    t.plan(2)\n    S(\n        S.error(new Error('test')),\n        Catch(function (err) {\n            return 'test data'\n        }),\n        S.collect(function (err, res) {\n            t.error(err, 'should not end with error')\n            t.deepEqual(res, ['test data'], 'should emit one event')\n        })\n    )\n})\n\ntest('callback is optional', function (t) {\n    t.plan(1)\n    S(\n        S.error(new Error('test')),\n        Catch(),\n        S.collect(function (err, res) {\n            t.error(err, 'should end stream without error')\n        })\n    )\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fpull-catch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichoth%2Fpull-catch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fpull-catch/lists"}