twlite / discord-ytdl-core

Simple ytdl wrapper for discord bots with custom ffmpeg args support.
https://www.npmjs.com/package/discord-ytdl-core
Apache License 2.0
52 stars 10 forks source link

Sometimes i have an error #9

Closed skiuelowsky closed 4 years ago

skiuelowsky commented 4 years ago

Status code: 416 Error [ERR_UNHANDLED_ERROR]: Unhandled error. (undefined) at PassThrough.emit (events.js:299:17) at errorOrDestroy (internal/streams/destroy.js:108:12) at PassThrough.onerror (_stream_readable.js:729:7) at PassThrough.emit (events.js:310:20) at PassThrough.<anonymous> (E:\KrzysBot\node_modules\ytdl-core\lib\index.js:139:16) at PassThrough.emit (events.js:310:20) at ClientRequest.<anonymous> (E:\KrzysBot\node_modules\miniget\dist\index.js:163:28) at Object.onceWrapper (events.js:417:26) at ClientRequest.emit (events.js:310:20) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27) { code: 'ERR_UNHANDLED_ERROR', context: undefined } i add try cause bot go down `stream.destroy = () => { stream._isDestroyed = true; if (req.abort) req.abort(); req.end(); req.removeListener('data', ondata); req.unpipe(); };

// Forward events from the request to the stream. [ 'abort', 'request', 'response', 'error', 'retry', 'reconnect', ].forEach(event => { req.prependListener(event, arg => {

  try {
    stream.emit(event, arg);
  } catch (error) {
    console.error(error)
  }

});

});

req.pipe(stream); };`

matrix-bot commented 4 years ago

I'd recommend joining the discord at https://discord.gg/fMzkHzg for easier/quicker support. (As I'm unsure the error)