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

Fails to parse #179

Open
dudewad opened this issue Jan 30, 2015 · 1 comment
Open

Fails to parse #179

dudewad opened this issue Jan 30, 2015 · 1 comment

Comments

@dudewad
Copy link

dudewad commented Jan 30, 2015

When I use the example from the repo to run groc, it works fine. However, I use load-grunt-tasks to load my task configurations from a separate file and when I define it there, I get errors.

Here is the trace:

! Failed to parse doc tags C:\dev\server\wamp\www\testApp\app\scripts\app.js: Cannot read property '1' of null
TypeError: Cannot read property '1' of null
at Object.module.exports.DOC_TAGS.param.parseValue (C:\dev\server\wamp\www\testApp\node_modules\grunt-groc\node_modules\groc\lib\doc_tags.coffee:124:7)
at Object.module.exports.Utils.parseDocTags (C:\dev\server\wamp\www\testApp\node_modules\grunt-groc\node_modules\groc\lib\utils.coffee:637:39)
at Default.module.exports.Base.renderFile (C:\dev\server\wamp\www\testApp\node_modules\grunt-groc\node_modules\groc\lib\styles\base.coffee:27:11)
at C:\dev\server\wamp\www\testApp\node_modules\grunt-groc\node_modules\groc\lib\project.coffee:83:15
at fs.js:271:14
at Object.oncomplete (fs.js:107:15)

Here is my task config:

module.exports = {
    javascript: {
        files: {src: ["<%=pkg.directories.dev_root %><%=pkg.directories.js %>*.js"]},
        options: {
            "out": "<%=pkg.directories.doc_root %>"
        }
    }
};

This is not an issue with configuration, but rather an issue that I see as a Groc flaw. If a doc comment does not contain a data type along with the parameter descriptions, this error is thrown. For example, the following doc comment will cause the error above to be thrown:

/**
 * @param e Some event object
 */
someFunc: function (e) {
    .....code.....
}

Since "e" here is not assigned a data type, I get the ! Failed to parse.... error, with no details on where/why/what this error is.

This should be reduced to a WARNING severity level and continue on in my opinion. Or, at the very least, a descriptive error message should explain where the error occurred because right now "property 1 of null" inside some obscure loop in the Groc inner-workings is not troubleshootable. Though it looks to me like there's just no catch for a possible check against null, so try-catch might be the intended solution here, just not implemented yet. Hope this helps!

@h4cc
Copy link

h4cc commented Feb 9, 2015

I can confirm this error, in my code any of these @param will let groc fail:

/**
 * @param anything
 */

with:

  Generating documentation...
! Failed to parse doc tags /home/julius/server/lib/Auth/Protocol.js: Cannot read property '1' of null
   TypeError: Cannot read property '1' of null
    at Object.module.exports.DOC_TAGS.param.parseValue (/usr/lib/node_modules/groc/lib/doc_tags.coffee:124:7)
    at Object.module.exports.Utils.parseDocTags (/usr/lib/node_modules/groc/lib/utils.coffee:641:39)
    at Default.module.exports.Base.renderFile (/usr/lib/node_modules/groc/lib/styles/base.coffee:28:11)
    at /usr/lib/node_modules/groc/lib/project.coffee:103:15
    at fs.js:272:14
    at Object.oncomplete (fs.js:108:15)

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

2 participants