Skip to content

Commit 79470f0

Browse files
committed
port setTags
1 parent fb505be commit 79470f0

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

packages/hub/src/exports.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Breadcrumb, CaptureContext, Event, Severity, SeverityLevel, Extras } from '@sentry/types';
1+
import { Breadcrumb, CaptureContext, Event, Extras, Primitive, Severity, SeverityLevel } from '@sentry/types';
22

33
import { getCurrentHub, Hub } from './hub';
44
import { Scope } from './scope';
@@ -95,3 +95,11 @@ export function setContext(name: string, context: { [key: string]: any } | null)
9595
export function setExtras(extras: Extras): ReturnType<Hub['setExtras']> {
9696
getCurrentHub().setExtras(extras);
9797
}
98+
99+
/**
100+
* Set an object that will be merged sent as tags data with the event.
101+
* @param tags Tags context object to merge into current context.
102+
*/
103+
export function setTags(tags: { [key: string]: Primitive }): ReturnType<Hub['setTags']> {
104+
getCurrentHub().setTags(tags);
105+
}

packages/minimal/src/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ function callOnHub<T>(method: string, ...args: any[]): T {
2929
throw new Error(`No hub defined or ${method} was not found on the hub, please open a bug report.`);
3030
}
3131

32-
/**
33-
* Set an object that will be merged sent as extra data with the event.
34-
* @param extras Extras object to merge into current context.
35-
*/
36-
export function setExtras(extras: Extras): void {
37-
callOnHub<void>('setExtras', extras);
38-
}
39-
40-
/**
41-
* Set an object that will be merged sent as tags data with the event.
42-
* @param tags Tags context object to merge into current context.
43-
*/
44-
export function setTags(tags: { [key: string]: Primitive }): void {
45-
callOnHub<void>('setTags', tags);
46-
}
47-
4832
/**
4933
* Set key:value that will be sent as extra data with the event.
5034
* @param key String of extra

0 commit comments

Comments
 (0)