mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
An attempt to safely release the `nonceLock` upon failure has instead made failure worse by masking it with a new error. If the call to get the `nonceLock` throws an exception, then the `finally` block here would attempt to call `releaseLock` on the `nonceLock` variable, which is guaranteed to be `undefined` if the previous call failed. The attempt to call a method on `undefined` throws another error, masking the original error. It is safer to obtain the `nonceLock` and release it without using any `try` or `finally` block. The `nonceLock` is synchronously released immediately after it is obtained, and any errors bubble up correctly without being masked. There is no case where the lock is left unreleased.