I am doing Practice 1 in Lesson 12 in the Foundation course in which I have to handle the assignment of wrong data types (Example: assigning a string to an integer variable).
The exercise requires checking two variables. The Try-Catch Activity works fine when I check one variable only, but when I add a Try-Catch Activity inside the first one to check the second variable, it detects the error but stops the process instead of moving to the Catch section!
In the assign activity you can set convert.Toint32(row(“columnname”).tostring) in the value place and i hope even you can pass the double value in the column.
Finally it will move to the catch and followed by the activity.
I tried changing the Assign value, but it did not work. The error prompt, however, has changed.
The new error: “Assign: Input string was not in a correct format.”
Here is the data in the table and I just need to fill the “Difference” column with the difference or an error message if one of the two values is not a number.
From the screenshot in the first post I see that I has thrown the error, and it has stopped there highlighting it in red. I believe the workflow is correct. Only thing is you are running the program in default Debug mode.
I debug mode, irrespective of whether you have a try catch or not, as soon as you run into an error, it will highlight it in red and stop there. At this instance, on the top ribbon of the Studio, in debug tab, you’ll see continue, step into kind of buttons. Use step in button to continue to the next step, it will get you into to the catch segment by running one step. Debug mode is to test the application. However, if you run in the Run mode (non debug mode) it will not stop there, and it will execute the catch statement automatically…
Try this and let me know whether you still have the problem
Hmm
I think you are running in debug mode
Kindly run in normal mode and try once, because debug mode won’t let the exception to be caught by catch block and throws error