Skip to content

Commit

Permalink
refactor: Don't update nodes if an error is thrown
Browse files Browse the repository at this point in the history
As per the feedback here, we don't want to reassign the value if an error is thrown: #21964 (comment)
  • Loading branch information
Siobhan committed May 21, 2024
1 parent 7a45fdf commit 631a8bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/library_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,13 +815,13 @@ FS.staticInit();` +
} catch (e) {
throw e;
} finally {
// update old node (called here to ensure consistency
// across fs implementations)
old_node.parent = new_dir;
// add the node back to the hash (in case node_ops.rename
// changed its name)
FS.hashAddNode(old_node);
}
// update old node (called here to ensure consistency
// across fs implementations)
old_node.parent = new_dir;
#if FS_DEBUG
if (FS.trackingDelegate['onMovePath']) {
FS.trackingDelegate['onMovePath'](old_path, new_path);
Expand Down

0 comments on commit 631a8bf

Please sign in to comment.