egg-onerror
egg-onerror copied to clipboard
feat: allow customize isProd function
Checklist
- [x]
npm test
passes - [x] tests and/or benchmarks are included
- [x] documentation is changed or added
- [x] commit message follows commit guidelines
Affected core subsystem(s)
Description of change
在碰到错误时,有一个判断是否为生产环境的逻辑 isProd,目前不能被自定义。故添加了自定义这个逻辑的功能,望采纳!
默认逻辑是看 app.config.env,如果不是 local 或者 unittest,就认为是正式生产环境,然而多数现实情况下,除了 local 和 unittest ,还有多个环境,比如:
- dev
- test
- stage
- prod
- canary
- qa 等等。很可能我们希望 dev 和 test 不算作正式环境(可以暴露原始错误堆栈信息)。
通过允许在 onerror
配置中自定义这个逻辑,可以让以上需求实现起来比较简单。
Codecov Report
Merging #30 (c51746e) into master (55d27e6) will increase coverage by
0.05%
. The diff coverage is100.00%
.
:exclamation: Current head c51746e differs from pull request most recent head 8958ad6. Consider uploading reports for the commit 8958ad6 to get more accurate results
@@ Coverage Diff @@
## master #30 +/- ##
==========================================
+ Coverage 96.98% 97.04% +0.05%
==========================================
Files 5 5
Lines 166 169 +3
==========================================
+ Hits 161 164 +3
Misses 5 5
Impacted Files | Coverage Δ | |
---|---|---|
lib/utils.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 55d27e6...8958ad6. Read the comment docs.
我们认为非本地环境都是在服务器部署的,行为应该一致,这个不应该被修改。
默认是这样,但应允许改写,保持灵活
获取 Outlook for Androidhttps://aka.ms/ghei36
From: Haoliang Gao [email protected] Sent: Monday, August 26, 2019 6:25:02 PM To: eggjs/egg-onerror [email protected] Cc: Jeff [email protected]; Author [email protected] Subject: Re: [eggjs/egg-onerror] feat: allow customize isProd function (#30)
我们认为非本地环境都是在服务器部署的,行为应该一致,这个不应该被修改。
― You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/eggjs/egg-onerror/pull/30?email_source=notifications&email_token=AAZWHDDBR5VRDDSF2PZQLE3QGOVP5A5CNFSM4ILJBP5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5D67BI#issuecomment-524808069, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAZWHDDSWBPHA7Q5DDXBQQ3QGOVP5ANCNFSM4ILJBP5A.
Duplicated with https://github.com/eggjs/egg-onerror/pull/33.