2
$\begingroup$

I am getting an error depicting an Uncaught Throw, with the accompanying code being returned:

Hold[Throw[$Failed, CURLLink`Utilities`Exception]]

I have managed to track down the function where the error is coming from by logging the part of code being run when the program fails, and am now attempting to use Catch[] to resolve the error. However, the error persists despite me wrapping Catch[] around the portion of code that I believe is responsible. Is there a limit to what can fit inside of Catch[]?

As far as my understanding of Catch[] goes, I thought that it would automatically grab any error messages being returned and prevent the program from quitting. Is my basic assumption about this function incorrect?

I have done a lot of research in my free time over the last few weeks to try and fix this bug, including looking over posts on this site, but understanding error correction properly has alluded me. I appreciate the help.

Here is a screenshot of the code, which pulls certain emails from my account: enter image description here

$\endgroup$
4
$\begingroup$

It looks like you're using a single-arg Catch. Single-arg Catch will not catch a multi-arg Throw. Compare:

Catch[Throw[1, "FOO"]]

Throw::nocatch: Uncaught Throw[1,FOO] returned to top level.

Hold[Throw[1, "FOO"]]

with:

Catch[Throw[1, "FOO"], "FOO"]

1

Perhaps that's all that's wrong?

$\endgroup$
  • $\begingroup$ Awesome, thanks! I was not aware there could be multiple arguments to a Throw[] - I will try that out and let it run to see if it fixes the problem! $\endgroup$ – Jmeeks29ig Jun 22 at 1:19
  • $\begingroup$ It seems to be working, thanks! $\endgroup$ – Jmeeks29ig Jun 22 at 19:10
  • $\begingroup$ Just for completeness: a catch-all version would be Catch[code,_]. This would help even if a Throw with any other tag would be evaluated... $\endgroup$ – Albert Retey Jun 23 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.