Error function does not print but halts script

As far as I know, the error function prints the error message in red in the output console when called outside of a protected call. I’ve the following scenario that don’t respect this property. This code runs inside the ProcessReceipt callback. There is no higher order function altering the behavior of the callback.

pcall(executeDevProductHandler) --The handler is a closure and also has a pcall inside it.
error("This is an error.") -- The error stops the thread execution but nothing gets printed in the studio terminal.

This bug only occurs in this very specific context. If a put the error before calling executeDevProductHandler, the error message prints on the terminal.

I was able to isolate and reproduce the error in a separate file. It seems that DataStoreB SaveAll is responsible for the problem. DataStoreB is my fork from the popular DataStore2 module. Is very similar in behavior and uses Promises to handle async operations.

In my file there are two errors commented out inside process receipt. One before the handler is pcalled and the other after it. The first error stops the code and show the message in the prompt (i.e. the expected behavior). The second error stops the code (the following print statement is not executed) but shows no message whatsoever.

This file must be published to a place slot with API access enabled via game settings to cause the issue to happen.

ErrorDontPrintMessageOnConsole.rbxlx (87.4 KB)

1 Like