This probably sounds stupid and I am probably missing some small little detail about scripting or protecting your functions but anyway.
I’ve used pcall before on small amounts of HTTP service code, but I’m wondering about more broader code.
Is it logical to put a pcall around everything to allow a script to sort of recover itself when it encounters an error? Or should I just be more strategic with checking before I use things gathered outside the script (like from HttpService)? Not too sure on this one.
Wrap a pcall around functions that have a chance to error (in a normal situation), so the execution won’t be stopped and you can possibly show the error to the player (if it is a player-facing component).
Don’t wrap a pcall around everything. Errors shouldn’t occur, unless some bug is present. It’s better to fix that bug instead of letting the code just continue and eventually break (with more damage, for example when states are messing up completely, or when a memory leak continues).
In a pcall, the execution of the pcall stops, however the script itself doesn’t. So, it’s not helping a lot to wrap pcalls around everything.