Whenever an async function overflows, there are two messages being output in the console via stdout and stderr: RangeError: Maximum call stack size exceeded, Exception in PromiseRejectCallback:.
I am making a library which handles the overflow and outputs the error, but the problem is that I don't think there is an API for turning those messages off. The only relevant things I found were this node.js code and this test. Even process.stdout.write = process.stderr.write = () => {} doesn't work to remove those messages.
[EDIT]:
I forgot to mention that I am already handling all the error events for node: uncaughtException and unhandledRejection. There are additional messages from Node.js only for stack overflows in promises.
With console.error you can do something like
const origConErr = console.error
console.error = (...args) => {
if (typeof args[0] !== 'string' || !args[0].starsWith('msg to filter')) {
return origConErr.apply(console, args)
}
}
But that doesn't work for RangeError: Maximum call stack size exceeded, Exception in PromiseRejectCallback:.