@@ -30,52 +30,51 @@ import { closeSession, makeSession, updateSession } from './session';
3030import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent' ;
3131import { parseEventHintOrCaptureContext } from './utils/prepareEvent' ;
3232
33- // Note: All functions in this file are typed with a return value of `ReturnType<Hub[HUB_FUNCTION]>`,
34- // where HUB_FUNCTION is some method on the Hub class.
35- //
36- // This is done to make sure the top level SDK methods stay in sync with the hub methods.
37- // Although every method here has an explicit return type, some of them (that map to void returns) do not
38- // contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable.
39-
4033/**
4134 * Captures an exception event and sends it to Sentry.
42- * This accepts an event hint as optional second parameter.
43- * Alternatively, you can also pass a CaptureContext directly as second parameter.
35+ *
36+ * @param exception The exception to capture.
37+ * @param hint Optinal additional data to attach to the Sentry event.
38+ * @returns the id of the captured Sentry event.
4439 */
4540export function captureException (
4641 // eslint-disable-next-line @typescript-eslint/no-explicit-any
4742 exception : any ,
4843 hint ?: ExclusiveEventHintOrCaptureContext ,
49- ) : ReturnType < Hub [ 'captureException' ] > {
44+ ) : string {
45+ // eslint-disable-next-line deprecation/deprecation
5046 return getCurrentHub ( ) . captureException ( exception , parseEventHintOrCaptureContext ( hint ) ) ;
5147}
5248
5349/**
5450 * Captures a message event and sends it to Sentry.
5551 *
56- * @param message The message to send to Sentry .
57- * @param Severity Define the level of the message.
58- * @returns The generated eventId .
52+ * @param exception The exception to capture .
53+ * @param captureContext Define the level of the message or pass in additional data to attach to the message.
54+ * @returns the id of the captured message .
5955 */
6056export function captureMessage (
6157 message : string ,
6258 // eslint-disable-next-line deprecation/deprecation
6359 captureContext ?: CaptureContext | Severity | SeverityLevel ,
64- ) : ReturnType < Hub [ 'captureMessage' ] > {
60+ ) : string {
6561 // This is necessary to provide explicit scopes upgrade, without changing the original
6662 // arity of the `captureMessage(message, level)` method.
6763 const level = typeof captureContext === 'string' ? captureContext : undefined ;
6864 const context = typeof captureContext !== 'string' ? { captureContext } : undefined ;
65+ // eslint-disable-next-line deprecation/deprecation
6966 return getCurrentHub ( ) . captureMessage ( message , level , context ) ;
7067}
7168
7269/**
7370 * Captures a manually created event and sends it to Sentry.
7471 *
75- * @param event The event to send to Sentry.
76- * @returns The generated eventId.
72+ * @param exception The event to send to Sentry.
73+ * @param hint Optional additional data to attach to the Sentry event.
74+ * @returns the id of the captured event.
7775 */
78- export function captureEvent ( event : Event , hint ?: EventHint ) : ReturnType < Hub [ 'captureEvent' ] > {
76+ export function captureEvent ( event : Event , hint ?: EventHint ) : string {
77+ // eslint-disable-next-line deprecation/deprecation
7978 return getCurrentHub ( ) . captureEvent ( event , hint ) ;
8079}
8180
0 commit comments