The way I do it is by adding labels on the screen and putting pieces of codes in one or many labels to see the outcome of each step. I know it's not exactly what you are looking for, but it's a way to check which step fails and why.
---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.
Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com