matthewmueller / matthewmueller/vo

bug in debug mode!!!!!!

Open
#12 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
233
Forks
6
PR merge metrics
No merged PRs in 30d

Description

my test code:

const vo = require('vo');
function * go() {
    try {
        console.log(1);
        throw new Error('rrrr');
        return true;
    } catch (error) {
        throw error;
    } finally {
        console.log('finally')
    }
}

vo(go)
    .then(r => {
        console.log('then: ', r);
    }).catch(e => {
    console.error("catch:", e);
});

no debug mode:

node test
1
finally
catch: Error: rrrr
    at go (c:\node.data\posters\poster\test.js:5:15)
    at go.next (<anonymous>)
    at next (c:\node.data\posters\poster\node_modules\co\index.js:74:21)
    at c:\node.data\posters\poster\node_modules\co\index.js:45:5
    at wrap (c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:30:21)
    at func (c:\node.data\posters\poster\node_modules\vo\lib\compile.js:44:23)
    at next (c:\node.data\posters\poster\node_modules\vo\lib\pipeline.js:34:15)
    at Pipeline (c:\node.data\posters\poster\node_modules\vo\lib\pipeline.js:47:8)
    at c:\node.data\posters\poster\node_modules\vo\index.js:44:5
    at c:\node.data\posters\poster\node_modules\vo\index.js:101:9

in debug mode:

>set DEBUG=*,-not_this

>node test.js
  vo ↗ go() +0ms
1
finaly
c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:120
    if (str.length > limit) {
           ^

TypeError: Cannot read property 'length' of undefined
    at trim (c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:120:12)
    at c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:109:14
    at Array.map (native)
    at pretty (c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:108:30)
    at next (c:\node.data\posters\poster\node_modules\vo\lib\wrap.js:36:30)
    at Immediate.<anonymous> (c:\node.data\posters\poster\node_modules\co\index.js:52:14)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the example with DEBUG=*,-not_this using test.js, then inspect node_modules/vo/lib/wrap.js around trim (line 120), pretty (line 108), and next (line 36). Done means debug mode no longer crashes with the reported undefined-length TypeError while handling the example's error path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.