MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / tryCatch

Function tryCatch

test/helpers/exceptions.js:4–22  ·  view source on GitHub ↗
(promise, message)

Source from the content-addressed store, hash-verified

2const PREFIX2 = "Returned error: VM Exception while processing transaction: ";
3
4async function tryCatch(promise, message) {
5 try {
6 await promise;
7 throw null;
8 } catch (error) {
9 assert(error, "Expected an error but did not get one");
10 try {
11 assert(
12 error.message.startsWith(PREFIX + message),
13 "Expected an error starting with '" + PREFIX + message + "' but got '" + error.message + "' instead"
14 );
15 } catch (err) {
16 assert(
17 error.message.startsWith(PREFIX2 + message),
18 "Expected an error starting with '" + PREFIX + message + "' but got '" + error.message + "' instead"
19 );
20 }
21 }
22}
23
24module.exports = {
25 catchRevert: async function(promise) {

Callers 1

exceptions.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected