fs: do not throw exception after creating FSReqCallback
Once an `FSReqCallback` instance is created, it is a GC root until the underlying fs operation has completed, meaning that it cannot be garbage collected. This is a problem when the underlying operation never starts because an exception is thrown before that happens, for example as part of parameter validation. Instead, move all potentially throwing code before the `FSReqCallback` creation. PR-URL: https://github.com/nodejs/node/pull/35487 Reviewed-By:James M Snell <jasnell@gmail.com> Reviewed-By:
Joyee Cheung <joyeec9h3@gmail.com>
parent
18af0b0f
Please register or sign in to comment