public static getInstance(network: string): Ergo {
const config = getErgoConfig(network);
if (!Ergo._instances) {
Ergo._instances = new LRUCache<string, Ergo>({
max: config.network.maxLRUCacheInstances,
});
}
if (!Ergo._instances.has(config.network.name)) {
if (network) {
Ergo._instances.set(config.network.name, new Ergo(network));
} else {
throw new Error(
`Ergo.getInstance received an unexpected network: ${network}.`,
);
}
}
return Ergo._instances.get(config.network.name) as Ergo;
}
when initializing a network if I enter an invalid network like “sadefcqwr,l” no error will be returned.
this is the code I write:
import { Ergo } from './ergo';
const ergo = new Ergo('sadefcqwr,l');
console.log(ergo);
Case
based on the code below:
when initializing a network if I enter an invalid network like “sadefcqwr,l” no error will be returned.
this is the code I write:
and this is the output: