{"id":44513644,"url":"https://github.com/7revor/babel-plugin-promise-catcher","last_synced_at":"2026-02-13T16:16:14.125Z","repository":{"id":57188881,"uuid":"199755394","full_name":"7revor/babel-plugin-promise-catcher","owner":"7revor","description":"Automatically catch and report unhandled exceptions.","archived":false,"fork":false,"pushed_at":"2024-04-28T09:17:13.000Z","size":32,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T13:59:01.058Z","etag":null,"topics":["babel","babel-plugin"],"latest_commit_sha":null,"homepage":"","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/7revor.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}},"created_at":"2019-07-31T01:35:38.000Z","updated_at":"2024-04-28T09:17:16.000Z","dependencies_parsed_at":"2022-08-28T12:51:38.130Z","dependency_job_id":null,"html_url":"https://github.com/7revor/babel-plugin-promise-catcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/7revor/babel-plugin-promise-catcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7revor%2Fbabel-plugin-promise-catcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7revor%2Fbabel-plugin-promise-catcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7revor%2Fbabel-plugin-promise-catcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7revor%2Fbabel-plugin-promise-catcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/7revor","download_url":"https://codeload.github.com/7revor/babel-plugin-promise-catcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7revor%2Fbabel-plugin-promise-catcher/sbom","scorecard":{"id":5894,"data":{"date":"2025-08-11","repo":{"name":"github.com/7revor/babel-plugin-promise-catcher","commit":"572a66d906e8db2903b5c8441cdef84098acb06c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-14T13:32:40.448Z","repository_id":57188881,"created_at":"2025-08-14T13:32:40.448Z","updated_at":"2025-08-14T13:32:40.448Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29412127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["babel","babel-plugin"],"created_at":"2026-02-13T16:16:09.262Z","updated_at":"2026-02-13T16:16:14.112Z","avatar_url":"https://github.com/7revor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Start\n```bash\nyarn add babel-plugin-promise-catcher --dev\n```\n## What did promise catcher do?\n- Automatically append `.catch` to `Promise`(You can filter by directory) and report error info(customization)\n- Automatically wrap `FunctionDeclaration` and  `ClassMethod` with `try-catch`,but opening this option results in `try-catch` multiple nesting.\nIt is recommended to filter with `functional Dirs`. Close by default and needs to be turned on manually.\n\n\n## code in\n```jsx harmony\nfunction Foo(){\n  console.log('Im foo')\n}\npromise().then((res)=\u003e{\n\n})\n\npromise2().then(res=\u003e{\n  \n}).catch(err=\u003e{\n  console.log('im error')\n})\n\n\npromise3().catch(err=\u003e{\n  console.log('im error')\n})\n```\n## code out\n```jsx harmony\nimport {report} from 'xxx'\n\nfunction Foo(){\n  try{\n    console.log('Im foo')\n  }catch (e) {\n    report(e)\n  }\n  \n}\npromise().then(res =\u003e {}).catch(err =\u003e {\n    report(err);\n});\n\npromise2().then(res=\u003e{\n  \n}).catch(e=\u003e{\n  report(e)\n   console.log('im error')\n})\n\npromise3().catch(err=\u003e{\n  report(e)\n  console.log('im error')\n})\n```\n\n## webpack.config.js\n```jsx harmony\nmodule: {\n    rules: [\n          {\n            test: /\\.js$/,\n            exclude:/node_modules/,\n            use:[\n              {\n                loader:'babel-loader',\n                options:{\n                  plugins:[\n                    ['babel-plugin-promise-catcher',{\n                        import:{\n                          name:'reportInfo', // 引入的上报方法\n                          source:'./reportService', // 方法地址\n                          isDefault:true // 是否为默认引入\n                          },\n                        functionCatch:false, // 为方法自动添加try-catch 默认为false\n                        functionDirs:['/src/'], // 方法捕获目录\n                        promiseCatch:true, // 为promise.then 自动添加 try-catch 默认为true\n                        promiseDirs:['/src/'], // promise 捕获目录\n                        info:{ // 错误上报信息，默认全为true\n                          fileName:true,\n                          line:true\n                          },\n                        ignoreFiles:['reportService.js']\n                  }]\n                  ]\n                },\n              }\n            ],\n          }\n        ]\n  }\n```\n### option\n- `import:object`  Function information imported\n    - `name:string` function name\n    - `source:string` function path\n    - `isDefault:boolean`\n        - `true` : `import report from 'xxx'`\n        - `false`: `import {report} from 'xx'`\n        \n- `reportFn:string` Error handling method,it should be declared in the entry file.If option contains import, this will fail.\n- `functionCatch:boolean` default  false\n- `promiseCatch:boolean` default true\n- `info:object`  error info\n    - `fileName:boolean` \n    - `line:boolean` \n- `ignoreFiles:Array\u003cstring\u003e` Ignored File Name\n- `promiseDirs:Array\u003cstring\u003e` Promise capture directory\n- `functionDirs:Array\u003cstring\u003e` Function capture directory\n\n\n### Attention\n- `promiseDirs`and `functionDirs`have higher priority than `functionCatch` and `promiseCatch`.\nin another way,if dirs are empty,then no capture is made.And if dirs are passed in, the catch option is ignored.\n- ` ignoreFiles `takes precedence over `dirs`. If a file exists in the specified directory and be declared as `IgnoreFiles`, no capture is performed.\n- There must be one between `import` and  `reportFn`.It is recommended to declare `reportFn` in the entry file. Use `import` in special cases.\n- ` import` priority is higher than `reportFn`. If they are passed in at the same time, then the capture method is named `import.name`.\n\n\n### import \n- eg.\n```jsx harmony\nimport:{\n  name:'report', \n  source:'reportService', \n  isDefault:false \n}\n```\ninject statement:\n```jsx harmony\nimport { report } from 'reportService'\n```\n- eg.\n```jsx harmony\nimport:{\n  name:'report', \n  source:'reportService', \n  isDefault:true \n}\n```\ninject statement:\n```jsx harmony\nimport report from 'reportService'\n```\nerror handler\n```jsx harmony\nreport(err,['example.js', 120])\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7revor%2Fbabel-plugin-promise-catcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F7revor%2Fbabel-plugin-promise-catcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7revor%2Fbabel-plugin-promise-catcher/lists"}