mapbox / mapbox/node-cpp-skel

try/catch in HandleOKCallback

未关闭
#114 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

good first issue
主要语言
C++
星标
74
派生
9
PR 合并指标
30 天内没有已合并 PR

描述

We should add try/catch around code in the HandleOKCallback like https://github.com/mapbox/node-cpp-skel/blob/c3d13e76cfb1178c92bf8beca822da4aba8c28f7/src/object_async/hello_async.cpp#L179-L186. Otherwise down stream developers are likely to:

- add new code to the HandleOKCallback
- in many instances that code might throw
- a throw will not be caught automatically and will instead crash the process with an `abort`

An example is https://github.com/mapbox/vtquery/issues/69 /cc @mapsam

We must protect against crashes like this, so I think its worth adding try/catch around the code in node-cpp-skel. Then users would be forced (due to the lack of coverage of the `catch` to think hard about whether an exception is possible.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

Start with the referenced src/object_async/hello_async.cpp example, especially lines 179-186, and locate HandleOKCallback in node-cpp-skel. Add the requested exception handling around its callback code, then verify that downstream exceptions are caught rather than aborting the process.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp, node.js
领域
backend
Issue 类型
功能
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。