mapbox / mapbox/node-cpp-skel

try/catch in HandleOKCallback

Ouverte
#114 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

good first issue
Langage dominant
C++
Étoiles
74
Forks
9
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp, node.js
Domaine
backend
Type d'issue
Fonctionnalité
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.