question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imposible to catch an error

See original GitHub issue

Hi, I am having troubles trying to open a magnet URL with this code:

const torrentStream = require('torrent-stream')

var magnetUrl = "weird magnet url"

try {
  ts = torrentStream(magnetUrl)
} catch (e) {
  console.log('it is not happening')
}

It returns

/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js:50
  throw new Error(
  ^

Error: Invalid data: Missing delimiter ":" [0x3a]
    at Function.decode.find (/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js:50:9)
    at Function.decode.bytes (/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js:103:23)
    at Function.decode.next (/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js:33:30)
    at Object.decode (/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/node_modules/bencode/lib/decode.js:19:17)
    at decodeTorrentFile (/Users/jose.galisteo/work/fuse-torrent/node_modules/parse-torrent-file/index.js:16:23)
    at parseTorrent (/Users/jose.galisteo/work/fuse-torrent/node_modules/torrent-stream/node_modules/parse-torrent/index.js:22:12)
    at /Users/jose.galisteo/work/fuse-torrent/node_modules/torrent-stream/index.js:621:21
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

I have no problems opening other magnet URLs; the weird thing is that the problematic magnet URL works well on webtorrent.

I would like at least be able to catch the error. Any suggestion? I can share the magnet URL by PM

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
josefsoncommented, Feb 29, 2020

I was also experiencing this same error on archlinux. It turned out after removing the /tmp/torrent-stream directory everything started working again

0reactions
ceritiumcommented, Jan 14, 2020

Not sure, It’s happening to me on macos.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Exceptions Cannot Be Caught by try-catch? | by bytefish
1. Can not catch syntaxError. When code reports an error, an exception cannot be caught if the thread has not yet entered a...
Read more >
How do you handle "impossible" exceptions in Java?
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Share.
Read more >
It's impossible to catch errors for futures that complete before ...
If a future completes with an error before a catchError callback is registered, it's seemingly impossible to catch that error.
Read more >
Error handling, "try...catch" - The Modern JavaScript Tutorial
So, try...catch can only handle errors that occur in valid code. Such errors are called “runtime errors” or, sometimes, “exceptions”.
Read more >
Solved: Hard to Catch Error - Microsoft Power BI Community
Solved: Hello, Could someone on the Microsoft side confirm what's going on in a certain hard to catch error scenario? For both of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found