How would I get all errors inside a pcall() or an xpcall()?

So as far as I am concerned, pcall() only returns one error message.
Say for example that I am an extraordinarily sloppy coder and make multiple spelling mistakes within a pcall.
How would I get all of the errors of that pcall()? or xpcall()? Everytime it runs it only gives the first error message.
I am relatively new to using these new terms so I am still understanding them, my overall knowledge may not be correct for these usecases.

Thanks!
-cooldeath49

1 Like

Just like a regular script, pcall stops executing and returns as soon as it gets an error. You would have to use multiple pcalls to get multiple errors.

1 Like

The only thing pcall is intended to do is catch your errors without terminating the script when it reaches an error. A regular script will terminate and throw an error for the first one it encounters, not for every issue in your script. The same goes for a pcall; the first error it meets, the error is caught and held.

Simple answer is you don’t and you shouldn’t need to. When your script meets an error, debug it and fix the issue, then move onto the next one until you aren’t encountering any more errors. You can also learn to be more prudent in the way you code and work on fixing the sloppiness you describe in the OP. Rereading your code or doing a quick review is helpful not just for coding but for any kind of writing.