feat: allow customize isProd function #30
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
npm test
passesAffected core subsystem(s)
Description of change
在碰到错误时,有一个判断是否为生产环境的逻辑 isProd,目前不能被自定义。故添加了自定义这个逻辑的功能,望采纳!
默认逻辑是看 app.config.env,如果不是 local 或者 unittest,就认为是正式生产环境,然而多数现实情况下,除了 local 和 unittest ,还有多个环境,比如:
等等。很可能我们希望 dev 和 test 不算作正式环境(可以暴露原始错误堆栈信息)。
通过允许在
onerror
配置中自定义这个逻辑,可以让以上需求实现起来比较简单。