export function* traverseErrorPrototypeChain(err: Error): Iterable { let current = err while ((current = Object.getPrototypeOf(current))) { yield current if (current === Error.prototype) break } }