atom / deprecation-cop

Shows a list of deprecated calls
MIT License
12 stars 19 forks source link

Deprecation Cop View breaks in latest atom release #8

Closed abe33 closed 9 years ago

abe33 commented 9 years ago

When trying to open the deprecation cop view in version 0.139.0-d1f9133 I get this error:

TypeError: Arguments to path.resolve must be strings
  at Object.exports.resolve (path.js:327:15)
  at Object.exports.relative (path.js:401:20)
  at DeprecationCopView.module.exports.DeprecationCopView.getPackageName (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:66:27)
  at Object.content (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:112:43)
  at Builder.tag (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:247:19)
  at Function.View.(anonymous function) (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:56:49)
  at Object.content (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:110:20)
  at Builder.tag (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:247:19)
  at Function.View.(anonymous function) (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:56:49)
  at Object.content (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:109:18)
  at Builder.tag (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:247:19)
  at Function.View.(anonymous function) (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:56:49)
  at Object.content (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:102:14)
  at Builder.tag (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:247:19)
  at Function.View.(anonymous function) (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:56:49)
  at Function.<anonymous> (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:94:12)
  at Function.View.buildHtml (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:96:10)
  at Function.View.render (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:102:19)
  at exports.$$ (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:682:24)
  at DeprecationCopView.module.exports.DeprecationCopView.update (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:93:22)
  at DeprecationCopView.module.exports.DeprecationCopView.afterAttach (/Users/cedric/github/atom/node_modules/deprecation-cop/lib/deprecation-cop-view.coffee:24:6)
  at callAttachHooks (/Users/cedric/github/atom/node_modules/space-pen/lib/space-pen.js:343:67)
  at atom-pane.PaneElement.activeItemChanged (/Users/cedric/github/atom/src/pane-element.coffee:97:7)
  at Emitter.module.exports.Emitter.emit (/Users/cedric/github/atom/node_modules/event-kit/lib/emitter.js:71:11)
  at Pane.module.exports.Pane.setActiveItem (/Users/cedric/github/atom/src/pane.coffee:260:16)
  at Pane.module.exports.Pane.activateItem (/Users/cedric/github/atom/src/pane.coffee:308:8)
  at /Users/cedric/github/atom/src/workspace.coffee:393:14
  at _fulfilled (/Users/cedric/github/atom/node_modules/q/q.js:787:54)
  at self.promiseDispatch.done (/Users/cedric/github/atom/node_modules/q/q.js:816:30)
  at Promise.promise.promiseDispatch (/Users/cedric/github/atom/node_modules/q/q.js:749:13)
  at /Users/cedric/github/atom/node_modules/q/q.js:810:14
  at flush (/Users/cedric/github/atom/node_modules/q/q.js:108:17)
  at process._tickCallback (node.js:378:11)
 workspace.coffee:400
(anonymous function)

By adding a try..catch in the problematic function I could confirm that this isn't due to a package in particular, it seems that every calls fails at that point. As far as I can tell, adding a try in the getPackageName loop is enough to get rid of the error without affecting the behavior of the view.

kevinsawicki commented 9 years ago

@abe33 Can you check if the fileName or packagePath value is wrong in that function?

I believe that error gets thrown by path.relative if either is not a string.

kevinsawicki commented 9 years ago

I put in better guards for both variables so this should be resolved in 0.139, thanks for reporting