Turns anything caught in a catch into an EconomyError. If it's already one, returns
it unchanged: re-wrapping could overwrite its retryable flag and wrongly mark a non-retryable
failure as safe to retry. Anything else (a raw exception from a library, the storage layer,
etc.) is wrapped as a retryable STORE.FAILURE, with the original kept in cause for logs so
the caller never sees the raw error or its stack trace.
try { awaitstore.transact(accounts, work); } catch (error) { thrownormalizeError(error); // an EconomyError either way; raw throws become STORE.FAILURE }
Turns anything caught in a
catchinto an EconomyError. If it's already one, returns it unchanged: re-wrapping could overwrite its retryable flag and wrongly mark a non-retryable failure as safe to retry. Anything else (a raw exception from a library, the storage layer, etc.) is wrapped as a retryable STORE.FAILURE, with the original kept incausefor logs so the caller never sees the raw error or its stack trace.