Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getCurrentHub(): Hub {
const globalHub = getCurrentHubBase();
if (!domain.active) {
return globalHub;
}
let carrier = domain.active.__SENTRY__;
if (!carrier) {
domain.active.__SENTRY__ = carrier = {};
}
if (!carrier.hub) {
const top = globalHub.getStackTop();
carrier.hub = top ? new Hub(top.client, top.scope) : new Hub();
}
return carrier.hub;
}