Gérer les exceptions dans un thread
Bonjour,
J'ai un thread dans lequel je n'arrive pas à gérer les exceptions.
Après quelques recherche sur internet j'ai trouvé quelques piste que je n'arrive pas à adapter:oops:.
Je vous demande donc votre aide pour trouver une solution et essayer de me l'expliquer simplement.:)
Pour l'instant, j'ai simplement un try/catch avec un "throw new Exception".
Voici l'appel de mon thread :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
try
{
ThreadStart threadDelegate=new ThreadStart(Fct.Routine.LancerRoutine);
threadRoutine = new Thread(threadDelegate);
threadRoutine.Start();
Thread threadRoutine;
}
catch(Exception exc)
{
Fct.signaler(exc);
} |
Et voici mon thread :
Code:
1 2 3 4 5 6 7 8 9 10
| public static void LancerRoutine()
{
try
{
// Code.
}
catch (Exception _ex)
{
throw new Exception(_ex.Message, _ex);
} |