Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using v0.1.0 #36

Closed
aredridel opened this issue Oct 9, 2011 · 14 comments
Closed

Error using v0.1.0 #36

aredridel opened this issue Oct 9, 2011 · 14 comments

Comments

@aredridel
Copy link

/usr/local/lib/node_modules/dox/lib/dox.js:70
comment.code = code;
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/usr/local/lib/node_modules/dox/lib/dox.js:70:18)
at [object Object]. (/usr/local/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)

For every file I try to process.

@mbrevoort
Copy link

Same here. Ran it on two files, undefined reference bomb outs on both...


dox --debug < app.js

/usr/local/lib/node_modules/dox/lib/dox.js:44
comment.code = code = buf.trim();
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/usr/local/lib/node_modules/dox/lib/dox.js:44:22)
at [object Object]. (/usr/local/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)


dox --debug < app-cluster.js

/usr/local/lib/node_modules/dox/lib/dox.js:70
comment.code = code;
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/usr/local/lib/node_modules/dox/lib/dox.js:70:18)
at [object Object]. (/usr/local/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)

@agreco
Copy link

agreco commented Oct 13, 2011

I'm getting the same error but with version 0.1.1

@tj
Copy link
Owner

tj commented Oct 13, 2011

keep in mind the latest dox is a lot different, it's just a json representation of your docs now

@agreco
Copy link

agreco commented Oct 13, 2011

oh yeah totally, the same error is still occurring though

@agreco
Copy link

agreco commented Oct 13, 2011

here is an sample:

agreco:src agreco$ dox < env.js > env.json

/Users/agreco/local/node/lib/node_modules/dox/lib/dox.js:44
comment.code = code = buf.trim();
^
TypeError: Cannot set property 'code' of undefined
at Object.parseComments (/Users/agreco/local/node/lib/node_modules/dox/lib/dox.js:44:22)
at [object Object]. (/Users/agreco/local/node/lib/node_modules/dox/bin/dox:40:17)
at [object Object].emit (events.js:61:17)
at afterRead (fs.js:878:12)
at wrapper (fs.js:245:17)

I'm using node 0.4.12 for context

@tj
Copy link
Owner

tj commented Oct 13, 2011

ah, ok cool, i'll have to get more test-cases and fix any formatting im not covering

@tj
Copy link
Owner

tj commented Oct 13, 2011

ideally we'd use a "proper" javascript parser and just pluck out the comments etc, it's a nice hack currently

@agreco
Copy link

agreco commented Oct 13, 2011

cool cool, cheers mate

@TooTallNate
Copy link
Contributor

This error happens when there's a JavaScript snippet without a comment block before it.

@nopnop
Copy link
Contributor

nopnop commented Nov 27, 2011

Following code illustrate this bug :

// Copyright stuff

/**
 * My Comment
 */

I suggest not to take into account the buffer in this case :

dox.js :

  if (buf.trim().length) {
    comment = comments[comments.length - 1];
    if(comment) {
        comment.code = code = buf.trim();
        comment.ctx = exports.parseCodeContext(code);
    }
    buf = '';
  }

See https://github.com/nopnop/dox

@aredridel aredridel reopened this Nov 28, 2011
@aredridel
Copy link
Author

Wow. Misclick on my part there.

tj added a commit that referenced this issue Dec 7, 2011
Fixed bug with crashing (issue #36)
@it-ony
Copy link

it-ony commented Apr 3, 2012

This Issue is still exisiting, Merged fix isn't in current branch.
See https://github.com/visionmedia/dox/blob/master/lib/dox.js

@ForbesLindesay
Copy link
Contributor

dox does now take the reasonable default of not including any code before the first comment, not sure if it's ideal, but probably good enough to close the issue? Or do we want the same behaviour as for a completely blank file, i.e. output a comment with no content to the comment and just the code + context?

@evindor
Copy link
Collaborator

evindor commented Sep 4, 2014

Seems to be outdated.

@evindor evindor closed this as completed Sep 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants