spoticord icon indicating copy to clipboard operation
spoticord copied to clipboard

Issue when closing spotify, would love to recreate this. Finna rewrite this so much better.

Open dustinrouillard opened this issue 6 years ago • 4 comments

When closing spotify this happens, javascript doesn't seem to be your strong suit. But bugs happen.

C:\Users\Tetrabyte\Documents\spoticord\app.js:59
    if (!res.track.track_resource || !res.track.artist_resource) return;
                  ^

TypeError: Cannot read property 'track_resource' of undefined
    at C:\Users\Tetrabyte\Documents\spoticord\app.js:59:19
    at Request._callback (C:\Users\Tetrabyte\Documents\spoticord\spotify.js:59:16)
    at Request.self.callback (C:\Users\Tetrabyte\Documents\spoticord\node_modules\request\request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (C:\Users\Tetrabyte\Documents\spoticord\node_modules\request\request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (C:\Users\Tetrabyte\Documents\spoticord\node_modules\request\request.js:1085:12)
    at Object.onceWrapper (events.js:314:30)

dustinrouillard avatar Dec 04 '17 12:12 dustinrouillard

Well this is obvious. Since you just closed Spotify, you obviously can't retrieve the track so the object is just undefined

tilda avatar Dec 05 '17 04:12 tilda

Okay but listen, yes I closed spotify but this error can be caught... Should be caught, you should never have code with errors in it...

dustinrouillard avatar Dec 05 '17 04:12 dustinrouillard

https://github.com/nations/spoticord/pull/39

dustinrouillard avatar Dec 05 '17 04:12 dustinrouillard

@TheTetrabyte is actually right. Never have code run issues. Just check for "undefined" and emit the process. It's very much needed, especially when you run Spoticord with a process manager like pm2.

visualcookie avatar Dec 15 '17 02:12 visualcookie