From 3a1f4c6c6f81a6e9df65258238902c723e3c4a9a Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 3 May 2021 12:35:59 +0200 Subject: [PATCH] use async/await --- libs/remix-lib/src/execution/execution-context.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/remix-lib/src/execution/execution-context.ts b/libs/remix-lib/src/execution/execution-context.ts index 296ab84766..4f2bb04483 100644 --- a/libs/remix-lib/src/execution/execution-context.ts +++ b/libs/remix-lib/src/execution/execution-context.ts @@ -40,8 +40,9 @@ class StateManagerCommonStorageDump extends StateManager { } dumpStorage (address) { - return new Promise((resolve, reject) => { - this._getStorageTrie(address).then((trie) => { + return new Promise(async (resolve, reject) => { + try { + const trie = await this._getStorageTrie(address) const storage = {} const stream = trie.createReadStream() stream.on('data', (val) => { @@ -54,9 +55,9 @@ class StateManagerCommonStorageDump extends StateManager { stream.on('end', function () { resolve(storage) }) - }).catch((error) => { - reject(error) - }) + } catch (e) { + reject(e) + } }) }