mapbox / mapbox/node-or-tools

Expose machine-readable cause of error in callback result

Open
#15 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
155
Forks
47
PR merge metrics
No merged PRs in 30d

Description

In case of an error in the bindings [we use SetErrorMessage](https://github.com/mapbox/node-or-tools/blob/289c9dbd4065717903e36fdc26356acabd70850a/src/tsp_worker.h#L30-L31) in both the TSP and VRP worker to let NAN generate an Js Error for us. What we should add is not only a message but also a parse-able code, think:

```javascript
{code: 'Timeout', message: 'Unable to find a solution, solver timed out'}
```

---

Implementation: in the async. workers override

```c++
void HandleErrorCallback()
```

and generate a Js Error object.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/tsp_worker.h and the SetErrorMessage usage linked in the issue, then inspect HandleErrorCallback in the asynchronous TSP and VRP workers. Confirm how NAN creates the JavaScript Error and make the callback expose both a machine-readable code and the existing message for each worker's error path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, node.js
Domain
api, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.