Use logger in error/warning messages (#2790)

* Use logger in error/warning messages

* Update packages/types/src/codec/BTreeSet.ts

* Update expectation

* Some additional type tests
This commit is contained in:
Jaco Greeff
2020-10-27 13:14:03 +01:00
committed by GitHub
parent be1deb1a75
commit bb7b94dc35
12 changed files with 78 additions and 21 deletions
@@ -3,9 +3,13 @@
import { Registry } from '@polkadot/types/types';
import { logger } from '@polkadot/util';
import extractTypes from './extractTypes';
import flattenUniq from './flattenUniq';
const l = logger('metadata');
/** @internal */
export default function validateTypes (registry: Registry, types: string[], throwError: boolean): void {
const missing = flattenUniq(extractTypes(types)).filter((type) => !registry.hasType(type));
@@ -16,7 +20,7 @@ export default function validateTypes (registry: Registry, types: string[], thro
if (throwError) {
throw new Error(message);
} else {
console.warn(message);
l.warn(message);
}
}
}