Prevent toSync from clobbering stack traces (#4980)
* Prevent toSync from clobbering stack traces
* Capture error on the outside of the toSync catch
* fmt
* Actually fix it 🤦
This commit is contained in:
@ -153,7 +153,10 @@ export function toSync<F extends AsyncFn<F>>(
|
||||
) => void | PromiseLike<void | null | undefined> | null | undefined
|
||||
): (...args: Parameters<F>) => void {
|
||||
return (...args: Parameters<F>) => {
|
||||
fn(...args).catch(onReject)
|
||||
void fn(...args).catch((...args) => {
|
||||
console.error(...args)
|
||||
return onReject(...args)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user