jsdoc2md / jsdoc-to-markdown

Generate markdown documentation from jsdoc-annotated javascript
MIT License
1.69k stars 152 forks source link

Cryptic error message 'Parameter 'url' must be a string, not undefined' #7

Closed evil-shrike closed 10 years ago

evil-shrike commented 10 years ago

Running jsdoc2md againt a bunch of js files and getting weird error.

C:\Work\>jsdoc2md C:\Work\src\lib\*.js > 1.md
Parameter 'url' must be a string, not undefined

Something is wrong but what and where?

75lb commented 10 years ago

i've got a feeling that's coming from jsdoc.. do you have jsdoc installed? if so, could you try running jsdoc against your source and see if you get same issue? failing that, please send over a gist of the source file causing breakage..

75lb commented 10 years ago

could you post some code to help me reproduce this?

evil-shrike commented 10 years ago

No, I don't have jsdoc3 installed. It's hard to figure out what cause the error - that's because I fired the bug. It would be nice to report file name at least.

75lb commented 10 years ago

i agree it would be nice to report the file name - i do want to improve the exception reporting.. but in order to do that i need an exception to work with.. if you get another error like this, please let me know

evil-shrike commented 10 years ago

Hi. Here some details. Hope it it helps a bit.

C:\Work\R-n-D\xfw3_webclient\Client\src\lib>call jsdoc2md core.lang.js --verbose > core.lang.md
TypeError: Parameter 'url' must be a string, not undefined
    at Url.parse (url.js:107:11)
    at Object.urlParse [as parse] (url.js:101:5)
    at Object.linkTo (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\helpers\link-to.js:33:29)
    at Object.eval (eval at <anonymous> (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:181:23), <anonymous>:10:90)
    at ret (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\runtime.js:106:30)
    at ret [as param] (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:459:21)
    at Object.invokePartialWrapper [as invokePartial] (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\runtime.js:48:28)
    at Object.eval (eval at <anonymous> (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:181:23), <anonymous>:3:17)
    at prog (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\runtime.js:148:15)
    at Object.<anonymous> (C:\Users\Shrike\AppData\Roaming\npm\node_modules\jsdoc-to-markdown\node_modules\dmd\node_modules\boil-js\node_modules\handlebars\dist\cjs\handlebars\base.js:133:23)

jsdoc3 (3.3.0-alpha) parses this file successfully. I can send you the json parsed by jsdoc3

75lb commented 10 years ago

yes, this helps thanks.. the code is failing within a PR i recently accepted.. in order to reproduce this myself i need the source code, could you send the section from core.lang.js which is causing the issue? It doesn't need to be the whole file, but sending the whole file is fine too.. you can send me the link to a private gist if you want to keep it offline.

evil-shrike commented 10 years ago

Here's what causes the error: if remove * @param originalViewModel then error dissappears.

    lang.ViewModelExtender = lang.Class(/** @lends ViewModelExtender.prototype */ {
        /**
         * @class ViewModelExtender
         * @param originalViewModel
         */
        constructor: function (originalViewModel) {
            this.viewModel = lang.proxy(originalViewModel);
            this.eventBinder = new lang.EventBinder(this);
        },
        declareProp: function (name, initial, onChange) {
            this.viewModel.declareProp(name, initial);
            if (onChange)
                this.eventBinder.bind(this.viewModel, "change:" + name, onChange.bind(this.viewModel));
        },
        dispose: function() {
            this.eventBinder.unbind();
        }
    });
75lb commented 10 years ago

btw, i forgot to mention - running jsdoc2md with --verbose gives you a full error stack..

75lb commented 10 years ago

looking into the issue

75lb commented 10 years ago

fixed in https://github.com/75lb/dmd/commit/b3c354730055d5ceaa4b694f95236fb58abb7eee.

Please run either npm update -g jsdoc-to-markdown (global install) or npm update (local install) to pick up the new version of dmd..

If it fixes the issue, please let me know and close this issue :)

evil-shrike commented 10 years ago

yeah, it works, thanks.

75lb commented 10 years ago

i also pushed a fix to jsdoc2md so a broken operation outputs:

$ jsdoc2md broken.js
Error: Parameter 'url' must be a string, not undefined
(run jsdoc2md with --verbose for a stack trace)
75lb commented 10 years ago

pleased it works, thanks for the contribution :+1: