Functions that yield still print errors to output in a pcall

When running functions that yield through pcall, any errors still seem to be printed to output. Is this an issue that can be fixed? :wrench: Would be very useful to avoid unnecessary log cluttering which can be distracting and increase time consumption when debugging, since it calls for reviewing each error to ensure it was handled properly, and can obscure notable errors :mag:

This code produces the following output (ideally should not produce any output?):

pcall(function ()
	wait()
	error 'Should ideally not show up in output'
end)

76e85e9099c1e589b76cc1cbdb1f67e11f50c913.png

5 Likes

If you’re using pcall to prevent errors from showing up, you’re using pcall for the wrong reasons…
Ideally you’d want to write code that doesnt error. Does the pcall’d code break the current thread when it errors?

Perhaps he is using pcall() for web request / datastore request ?

1 Like

I am using pcall to handle errors from potentially unreliable sources (e.g. external APIs) that throw known, intentional exceptions :+1: It does not break the current thread (expected)—just outputs the error (unexpected).

2 Likes

For this bug to be actionable, please provide the sample code you’re using, and the output from this code in event of an error that you feel should be suppressed.

This code produces the following output (ideally should not produce any output?):

pcall(function ()
	wait()
	error 'Should ideally not show up in output'
end)

76e85e9099c1e589b76cc1cbdb1f67e11f50c913.png

This is still a problem. Also while it’s being fixed can pcall return the full stack trace instead of just the first line?