Skip to content

Function type syntax error not handled #351

@LukasHechenberger

Description

@LukasHechenberger

If a function type annotation is missing a parameter label an error is thrown from the DocBuilder class.
Of course, this is my fault, but it would be very nice if the error message contained the failing file or even better the invalid annotation. Currently I'm receiving the following output:

// Source.js
/**
 * Removes the item with the specified id.
 * @param {Number} id Id of the item to be removed.
 * @param {function(Error, removed: Number)} callback Called with the number of items removed.
 */
removeItem(id, callback) { ... }

(The callback parameter is missing a label for the Error argument)

.../node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:79
            throw _iteratorError;
            ^

TypeError: Cannot read property 'replace' of undefined
    at .../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:924:34
    at Array.map (native)
    at ClassDocBuilder._buildTypeDocLinkHTML (.../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:919:41)
    at ClassDocBuilder._buildSignatureHTML (.../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1156:33)
    at .../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:512:38
    at IceCap.loop (/Users/lukas/Documents/Partypics/Code/API/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at ClassDocBuilder._buildSummaryDoc (.../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:509:11)
    at ClassDocBuilder._buildSummaryHTML (.../node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:468:29)
    at ClassDocBuilder._buildClassDoc (.../node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:167:38)
    at ClassDocBuilder.exec (.../node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:64:36)

It was really hard to find out where the error occurred because I'm working on a really large project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions