zettajs / edison-cli

Cli node application manager for the edison
10 stars 3 forks source link

"edison-cli" list throws "TypeError: Cannot call method 'some' of undefined" error. #1

Closed landlessness closed 9 years ago

landlessness commented 9 years ago

When running edison-cli listI get TypeError: Cannot call method 'some' of undefined error.

> edison-cli list
/usr/local/lib/node_modules/edison-cli/lib/find.js:24
    return data.type.some(function(type){
                     ^
TypeError: Cannot call method 'some' of undefined
    at filter (/usr/local/lib/node_modules/edison-cli/lib/find.js:24:22)
    at null.<anonymous> (/usr/local/lib/node_modules/edison-cli/lib/find.js:30:9)
    at EventEmitter.emit (events.js:95:17)
    at internal.onMessage (/usr/local/lib/node_modules/edison-cli/node_modules/mdns-js/lib/browser.js:51:8)
    at null.<anonymous> (/usr/local/lib/node_modules/edison-cli/node_modules/mdns-js/lib/browser.js:132:26)
    at Socket.EventEmitter.emit (events.js:98:17)
    at UDP.onMessage (dgram.js:440:8)

After adding a console.log on the data being passed into filter(data), I see that some data objects do not have type objects. Confer with logs below.

The first data has a type element and runs fine.

{ addresses: [ '127.0.0.1' ],
  query: '_services._dns-sd._udp.local',
  type: 
   [ { name: 'afpovertcp',
       protocol: 'tcp',
       subtypes: [],
       description: 'Apple File Sharing' } ],
  interfaceIndex: 0,
  networkInterface: 'lo0' }

The second data does NOT have a type element and causes the error.

{ addresses: [ '127.0.0.1' ],
  query: '_services._dns-sd._udp.local',
  interfaceIndex: 3,
  networkInterface: 'en6' }
AdamMagaluk commented 9 years ago

Fixed in 2.0.0