From 1925ada995f5bc20e4647289e2ec608529a12670 Mon Sep 17 00:00:00 2001 From: Do Trung Kien Date: Wed, 26 Jun 2019 18:13:58 +0700 Subject: [PATCH] improve expectRevert output --- src/expectRevert.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/expectRevert.js b/src/expectRevert.js index b1bd9ce..7325de9 100644 --- a/src/expectRevert.js +++ b/src/expectRevert.js @@ -8,7 +8,8 @@ async function expectException (promise, expectedError) { await promise; } catch (error) { if (error.message.indexOf(expectedError) === -1) { - throw Error(`Wrong failure type, expected '${expectedError}' and got '${error.message}'`); + const actualError = error.message.replace('Returned error: VM Exception while processing transaction: ', ''); + assert.fail(`Wrong failure type, expected '${expectedError}' and got '${actualError}'`); } return; }