0

I'm developing a framework that wraps many other third-party frameworks and unifies them under a single API. Since I can't be sure that other developer are catching every exception they man cause, I wrap every call to a third-party library with try/catch clauses.

The only problem is that I can't tell what queue/thread those libraries work on, and so of course I can't be sure I'll catch every exception.

So the question is how can I ensure I can every exception from a third-party library if I don't know what thread it's working on?

Thanks!

Yotam
  • 9,789
  • 13
  • 47
  • 68
  • 1
    I say: Let the exceptions be free! – Margaret Bloom May 03 '16 at 09:51
  • Care to explain Bloom? If it's a joke pardon me, my sense of humour is turned off at work :) – Yotam May 03 '16 at 10:02
  • 1
    It's usually not advisable to catch exceptions just to silent them. Let them propagate to the upper layers, they have more context to make a decision. – Margaret Bloom May 03 '16 at 10:08
  • In my case it's not true - since I'm developing a mediator framework, if one (of the third-party frameworks I mediate) fails at any point, I can just use another. I most certainly don't want my clients to accuse me of not catching exceptions. – Yotam May 03 '16 at 10:10
  • You catch what **you know how to handle** and let everything else go up (documented), that's my point. So what's the question? Handling exceptions from spawned threads? See [this question](https://stackoverflow.com/questions/8859777/can-i-catch-exceptions-thrown-from-one-thread-in-another-thread-in-objective-c). – Margaret Bloom May 03 '16 at 10:16
  • Okay, my question good, I'll edit and ask here as well: since I can't tell what thread a third-party library is working on, and it could be a different one than the one I use when calling it, how can I ensure I catch exception from this library? – Yotam May 03 '16 at 10:37

0 Answers0