@polkadot/util#isError TypeScript Examples
The following examples show how to use
@polkadot/util#isError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Output.tsx From crust-apps with Apache License 2.0 | 6 votes |
format = (value: unknown): string => {
if (isError(value)) {
return value.stack ? value.stack : value.toString();
} else if (isUndefined(value)) {
return 'undefined';
} else if (isNull(value)) {
return 'null';
} else if (Array.isArray(value)) {
return `[${value.map((value): string => format(value)).join(', ')}]`;
} else if (value instanceof Map) {
return `{${[...value.entries()].map(([key, value]): string => (key as string) + ': ' + format(value)).join(', ')}}`;
}
return (value as string).toString();
}