-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexceptions.js
More file actions
22 lines (20 loc) · 769 Bytes
/
exceptions.js
File metadata and controls
22 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module.exports.errTypes = {
revert : "revert",
outOfGas : "out of gas",
invalidJump : "invalid JUMP",
invalidOpcode : "invalid opcode",
stackOverflow : "stack overflow",
stackUnderflow : "stack underflow",
staticStateChange : "static state change"
}
module.exports.tryCatch = async function(promise, errType) {
try {
await promise;
throw null;
}
catch (error) {
assert(error, "Expected an error but did not get one");
assert(error.message.startsWith(PREFIX + errType), "Expected an error starting with '" + PREFIX + errType + "' but got '" + error.message + "' instead");
}
};
const PREFIX = "Returned error: VM Exception while processing transaction: ";