"Input string was not in a correct format" ignoring it's try-catch condition

Hello ,
So , I have a very slight problem , as I’m trying to learn how to handle errors , I’m working on a voluntarily flawed excel file , where I AM expecting issues. However , for some reason , among the two try-catch blocs of my automation program , one of the assigns that is set in a “try” bloc gives me an “input string was not in a correct format” error , and it blocks the running of the debug run everytime , while the exact same assign for a near identical variable (the only difference being that this problematic one is acquired in the 3rd column and the other one is in the 2nd) is tried and eventually ignored as should be without any disturbance…
Would anyone happen to have an idea of what could be causing that issue ?

Edit: Moving said assign to the first try has caused the issue to now happen with both instead…

Edit 2 : It seems to be that having sequences within a try block causes that issue , however I do not get why that is , does anyone know something about that ?

Thankful regards , Bastien

Hello @B_Bastien ,

If possible, can you please share the screenshots of both try catch blocks you are using?

Thanks!
Athira

Of course !
Here it is :

The issue making one is the assign ChiffreOut
(that is the flawed version where I still have sequences within the 2nd try)

What is the value of CashIn and CashOut that you are getting from the excel?
I don’t think it’s an issue with the try-catch block, but with the CashIn-Cashout value. While running in debug mode, it will throw the exception evenif its inside a try catch block. After you click continue, it will go to the catch block and resumes the execution.

Thanks,
Athira

2 Likes

@B_Bastien I guess its not blocking. Actually, its one of the functionality of debug. When any exceptions occurs while running in debug mode it pause the execution. The moment you click on continue it resumes the process . Try click on continue and see how it goes

1 Like

The values are simply added letters to the integers that should be found , such as 14O , 150k and so on…
So it wouldn’t happen if I were to run it outside of debug mode ? That’s good to know , though I wonder why it only does occur when the issue is within a sequence in a try block , as the activity alone doesn’t bring out an issue…

I did , and it did go to the next row , many thanks!
Though , having it alone inside the try doesn’t make the execution stop and simply carries on , any idea how that works ?

Thanks ,
Bastien

If the value is 150k, it won’t be able to convert that to integer. That’s why its throwing error. It is not related to try catch block, but related to the input.
And yes, only in debug mode it will stop the execution abruptly.

Hope its clear.
Thanks!

2 Likes

It is , but if I were to have the WriteLine outside of the try-catch , and the assign in the try block without a sequence (as it is for the “Cash In” try) , it wouldn’t give me the error field , that is what I don’t understand here : Why is that happening specifically to the issues within sequences…

Thank you for your help !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.