You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v8.writeHeapSnapshot may return undefined if the file fails to write #41346
Would it be breakage, though? The method does not document the behaviour of the function when an error during the write happens, so I believe it's completely acceptable by the versioning system to make it throw an error instead.
Documenting it as returning undefined would make the change to throwing an error a breaking change one.
If you're sure with this behaviour/decision, I can try making a docs PR in a few hours once I have time.
Sometimes people depend on undocumented features and we tend to prefer not breaking their code, so yes a noticeable change in behavior does appear to be breaking to me.
If you're sure with this behaviour/decision, I can try making a docs PR in a few hours once I have time.
Nope, I'm not sure. Throwing an exception would have been my first choice if the function was a new addition but given that the function has existed in core for 3 years, we need to take breakage into consideration. The only reason I suggested sending a doc fix pr first was because it's easier to come up with doc only changes and you won't feel like your work has gone to waste if people think that throwing an exception is better. However, if you start off with a change that throws an exception which requires more work, your pr might get blocked and you would have to revert to a doc only change and that might not feel great.
Please feel free to send a PR to throw an exception if you feel strongly about it tho!
Activity
RaisinTen commentedon Dec 29, 2021
The upstream module returns an error for this - https://github.com/bnoordhuis/node-heapdump/blob/3537b67cebdbd602d8572fcc533f223ed25e5cbc/src/heapdump.cc#L94 but I'm not really sure if it's worth the breakage to incorporate that here. Would you like to send a doc fix PR first? Here's the relevant documentation -
node/doc/api/v8.md
Line 278 in f81c627
kyranet commentedon Dec 29, 2021
Would it be breakage, though? The method does not document the behaviour of the function when an error during the write happens, so I believe it's completely acceptable by the versioning system to make it throw an error instead.
Documenting it as returning
undefinedwould make the change to throwing an error a breaking change one.If you're sure with this behaviour/decision, I can try making a docs PR in a few hours once I have time.
RaisinTen commentedon Dec 30, 2021
Sometimes people depend on undocumented features and we tend to prefer not breaking their code, so yes a noticeable change in behavior does appear to be breaking to me.
Nope, I'm not sure. Throwing an exception would have been my first choice if the function was a new addition but given that the function has existed in core for 3 years, we need to take breakage into consideration. The only reason I suggested sending a doc fix pr first was because it's easier to come up with doc only changes and you won't feel like your work has gone to waste if people think that throwing an exception is better. However, if you start off with a change that throws an exception which requires more work, your pr might get blocked and you would have to revert to a doc only change and that might not feel great.
Please feel free to send a PR to throw an exception if you feel strongly about it tho!
v8: make writeHeapSnapshot throw if fopen fails
v8: make writeHeapSnapshot throw if fopen fails