luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

Package Search: error when version is a nil value #121

Closed james2doyle closed 9 years ago

james2doyle commented 9 years ago

I was doing a search (tag:cookie) and the querying would just seem to hang, this wasn't happening every time, but often enough that something seemed wrong.

Turns out there was a JS error for an undefined/null key. It happens here when results.matches is not an object.

I added some extra inline code to log the result object before the JS runs Object.keys. It returned a Lua error. Further up the line, it seems like there is a concatenation error in api.lua when version is nil https://github.com/luvit/lit/blob/62789efec8d4a7ac5937933bd2e3dff6399b2c0c/libs/api.lua#L145

Not sure what to do, but this is what I found after some simple snooping.

creationix commented 9 years ago

Thanks, I fixed the broken error message in https://github.com/luvit/lit/commit/3bc1a2f44ff506088905e9c3d631da1cba90847a.

But the root cause was I had manually removed a package (at author's request), but I didn't bother to remove the parent directories and the empty tag directory was causing the problem.

Fow now, I've removed empty tag folders, I'll see about fixing the logic to not crash on empty folders in the future (https://github.com/luvit/lit/issues/122)