I have this error that has been very difficult to determine where in my code it occurs. I have a lot of complicated systems, built from modules, and this particular error occurs when nearly all the processes are complete for processing a marketplace receipt and delivering the item purchased. I have a pcall in place, but all I can seem to get is the error message, but no specific line numbers that lead up to the error being triggered, so I don’t even know exactly what line it’s happening. I’ve tried going backwards from that spot, and putting in print statements to troubleshoot from the console, i’ve tried setting a breakpoint, but my code won’t run properly unless I’m using the client/server method of testing… Any ideas?
I found this helpful, especially the module linked at the end of the thread, which worked perfectly to trace my error, by creating an alternate yxpcall-like function.
You actually don’t need to rely on that implementation.
xpcall existed in Lua for a while but didn’t allow for the function to yield, such as for a DataStore call, so
yxpcall implementations were made.
xpcall was changed last year to allow for yielding, so the custom
yxpcall shouldn’t be used. You will also notice much better performance if errors are common or are long, like stack overflow errors.
Thanks for your help on this. Most of my code is very straightforward, and I’ve never needed xpcall or yxpcall to debug an error, but your solution was extremely helpful. Brilliant!