TypeError: Cannot read property 'split' of undefined #301

Closed
damirka opened this Issue Jun 22, 2016 · 7 comments

Comments

Projects
None yet
4 participants
@damirka

damirka commented Jun 22, 2016

Getting this error when trying to generate docs for multiple files.

Here is a log:

badge.svg
identifiers.html
index.html
class/components/redis/Connection.js~Connection.html
class/components/errors/DebugError.js~DebugError.html
class/components/errors/EmptyDataError.js~EmptyDataError.html
/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:79
            throw _iteratorError;
            ^
TypeError: Cannot read property 'split' of undefined
    at /usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1287:53
    at IceCap.loop (/usr/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at ClassDocBuilder._buildProperties (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1285:11)
    at /usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:651:41
    at IceCap.loop (/usr/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at ClassDocBuilder._buildDetailDocs (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:606:11)
    at ClassDocBuilder._buildDetailHTML (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:568:29)
    at ClassDocBuilder._buildClassDoc (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:172:44)
    at ClassDocBuilder.exec (/usr/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:64:36)
    at publish (/usr/lib/node_modules/esdoc/out/src/Publisher/publish.js:169:59)

And this is my config:

{
  "access": ["public", "protected", "private"],
  "source": "./app/components",
  "destination": "./out/esdoc",
  "undocumentIdentifier": true,
  "unexportIdentifier": true,
  "autoPrivate": false,
  "lint": false
}
@moroine

This comment has been minimized.

Show comment
Hide comment
@moroine

moroine Jun 23, 2016

Same issue on my side

moroine commented Jun 23, 2016

Same issue on my side

@damirka

This comment has been minimized.

Show comment
Hide comment
@damirka

damirka Jun 23, 2016

To @moroine:

I've found a way to fix this but it's completely incorrect and weird. Just added this condition:

// in /usr/lib/node_modules/esdoc/out/Publisher/Builder/DocBuilder#1288
if (prop.name === undefined) {
    return ice;
}

If you need a quick fix to generate docs - this can work. But I don't recommend to do it in any other case.

UPD: There's an ice.loop('property', properties, function (i, prop, ice) { ... }) block and in some cases (I didn't go further) prop can be an empty object or smth. So the name property is undefined.

It's funny that I've been migrating from JSDoc and after I removed some JSDoc tags (as I see now) it began to work properly even without this fix. 🎱

damirka commented Jun 23, 2016

To @moroine:

I've found a way to fix this but it's completely incorrect and weird. Just added this condition:

// in /usr/lib/node_modules/esdoc/out/Publisher/Builder/DocBuilder#1288
if (prop.name === undefined) {
    return ice;
}

If you need a quick fix to generate docs - this can work. But I don't recommend to do it in any other case.

UPD: There's an ice.loop('property', properties, function (i, prop, ice) { ... }) block and in some cases (I didn't go further) prop can be an empty object or smth. So the name property is undefined.

It's funny that I've been migrating from JSDoc and after I removed some JSDoc tags (as I see now) it began to work properly even without this fix. 🎱

@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms Nov 2, 2016

Here's an example that throws a similar error

export class Product {

    constructor ( a , b ) {
        this.a = a ;
        this.b = b ;
    }

    zero ( ) {
        return [ this.a.zero( ) , this.b.zero( ) ] ;
    }

    plus ( [ a , b ] , [ A , B ] ) {
        return [ this.a.plus( a , A ) , this.b.plus( b , B ) ] ;
    }

}

Commenting out the plus method or adding

    /**
     * @param first
     * @param second
     */

just before the plus method makes esdoc work again.

aureooms commented Nov 2, 2016

Here's an example that throws a similar error

export class Product {

    constructor ( a , b ) {
        this.a = a ;
        this.b = b ;
    }

    zero ( ) {
        return [ this.a.zero( ) , this.b.zero( ) ] ;
    }

    plus ( [ a , b ] , [ A , B ] ) {
        return [ this.a.plus( a , A ) , this.b.plus( b , B ) ] ;
    }

}

Commenting out the plus method or adding

    /**
     * @param first
     * @param second
     */

just before the plus method makes esdoc work again.

@damirka

This comment has been minimized.

Show comment
Hide comment
@damirka

damirka Nov 2, 2016

Seems to me it's somehow related to destructive assignment and it's parsing. Did you try any other ways?

// like this one
function example({ a: A, b: B }, c = null, [ d = null ]) {
  // check params inside
}

damirka commented Nov 2, 2016

Seems to me it's somehow related to destructive assignment and it's parsing. Did you try any other ways?

// like this one
function example({ a: A, b: B }, c = null, [ d = null ]) {
  // check params inside
}
@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms Nov 2, 2016

No but I think your guess is correct.

aureooms commented Nov 2, 2016

No but I think your guess is correct.

@h13i32maru

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Dec 27, 2016

Member

Thanks for this report.

I will fix this bug in next version.

Member

h13i32maru commented Dec 27, 2016

Thanks for this report.

I will fix this bug in next version.

@h13i32maru

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Dec 27, 2016

Member

I fixed this bug.
c8ae3f5

And will release in next version.

Member

h13i32maru commented Dec 27, 2016

I fixed this bug.
c8ae3f5

And will release in next version.

@h13i32maru h13i32maru closed this Dec 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment