findError updates (#2312)

* Bump deps

* Re-write yarn.lock

* findMetaError with asModule
This commit is contained in:
Jaco Greeff 2020-02-28 16:16:39 +01:00 committed by GitHub
parent d62509847c
commit 6f85ef418a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,12 +25,11 @@ export default function ErrorDisplay (props: Props): React.ReactElement<Props> {
useEffect((): void => {
if (details !== null && props.defaultValue?.value?.isModule) {
try {
const mod = (props.defaultValue.value as DispatchError).asModule;
const error = registry.findMetaError(new Uint8Array([mod.index.toNumber(), mod.error.toNumber()]));
const { documentation, name, section } = registry.findMetaError((props.defaultValue.value as DispatchError).asModule);
setDetails({
details: error.documentation.join(', '),
type: `${error.section}.${error.name}`
details: documentation.join(', '),
type: `${section}.${name}`
});
} catch (error) {
// Errors may not actually be exposed, in this case, just return the default representation