Will main() catch exceptions thrown from threads?

Will main() catch exceptions thrown from threads?

No

When a thread throws an exception, it is not caught by main. Is this the standard behavior?

Yes, this is standard behaviour.

To catch an exception originating in thread X, you have to have the trycatch clause in thread X (for example, around everything in the thread function, similarly to what you already do in main).

For a related question, see How can I propagate exceptions between threads?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)