@pendulum-chain/api-solang
Version:
Interface to interact with smart contracts compiled via Solang
20 lines (19 loc) • 681 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractDispatchErrorDescription = extractDispatchErrorDescription;
function extractDispatchErrorDescription(dispatchError) {
if (dispatchError.isModule) {
try {
const module = dispatchError.asModule;
const error = dispatchError.registry.findMetaError(module);
if (error.docs.length === 0) {
return `${error.section}.${error.name}`;
}
else {
return `${error.section}.${error.name}: ${error.docs[0]}`;
}
}
catch { }
}
return dispatchError.type.toString();
}