Backport fix for EIP-848 status codes from v4; only an error is generated in v3, the error string is ignored. (#262).
This commit is contained in:
parent
294d0fda61
commit
5efd0c1f8a
@ -3,6 +3,7 @@
|
|||||||
var Interface = require('./interface.js');
|
var Interface = require('./interface.js');
|
||||||
|
|
||||||
var utils = (function() {
|
var utils = (function() {
|
||||||
|
var convert = require('../utils/convert.js');
|
||||||
return {
|
return {
|
||||||
defineProperty: require('../utils/properties.js').defineProperty,
|
defineProperty: require('../utils/properties.js').defineProperty,
|
||||||
|
|
||||||
@ -10,7 +11,8 @@ var utils = (function() {
|
|||||||
|
|
||||||
bigNumberify: require('../utils/bignumber.js').bigNumberify,
|
bigNumberify: require('../utils/bignumber.js').bigNumberify,
|
||||||
|
|
||||||
hexlify: require('../utils/convert.js').hexlify,
|
arrayify: convert.arrayify,
|
||||||
|
hexlify: convert.hexlify,
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@ -124,9 +126,12 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
|
|||||||
|
|
||||||
}).then(function(value) {
|
}).then(function(value) {
|
||||||
try {
|
try {
|
||||||
|
if ((utils.arrayify(value).length % 32) !== 0) {
|
||||||
|
throw new Error('call exception');
|
||||||
|
}
|
||||||
var result = call.parse(value);
|
var result = call.parse(value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (value === '0x' && method.outputs.types.length > 0) {
|
if ((value === '0x' && method.outputs.types.length > 0) || error.message === 'call exception') {
|
||||||
errors.throwError('call exception', errors.CALL_EXCEPTION, {
|
errors.throwError('call exception', errors.CALL_EXCEPTION, {
|
||||||
address: addressOrName,
|
address: addressOrName,
|
||||||
method: call.signature,
|
method: call.signature,
|
||||||
|
Loading…
Reference in New Issue
Block a user