Expose machine-readable cause of error in callback result
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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