Skip to content

Commit 0da68e6

Browse files
committed
Merge remote-tracking branch 'origin/develop' into lforst-deprecate-hub-constructor
2 parents d24493a + 737fb0e commit 0da68e6

File tree

48 files changed

+30
-2535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+30
-2535
lines changed

.craft.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ targets:
132132
includeNames: /^sentry-internal-eslint-config-sdk-\d.*\.tgz$/
133133

134134
## 8. Deprecated packages we still release (but no packages depend on them anymore)
135-
- name: npm
136-
id: '@sentry/hub'
137-
includeNames: /^sentry-hub-\d.*\.tgz$/
138135
- name: npm
139136
id: '@sentry/tracing'
140137
includeNames: /^sentry-tracing-\d.*\.tgz$/

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ enum. If you were using the `Severity` enum, you should replace it with the `Sev
1111
The `Offline` integration has been removed in favor of the offline transport wrapper:
1212
http://docs.sentry.io/platforms/javascript/configuration/transports/#offline-caching
1313

14+
## Other changes
15+
16+
- Remove `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)
17+
1418
# Deprecations in 7.x
1519

1620
You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update

dev-packages/browser-integration-tests/utils/generatePlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const LOADER_CONFIGS: Record<string, { options: Record<string, unknown>;
115115
* When using compiled versions of the tracing and browser packages, their aliases look for example like
116116
* '@sentry/browser': 'path/to/sentry-javascript/packages/browser/esm/index.js'
117117
* and all other monorepo packages' aliases look for example like
118-
* '@sentry/hub': 'path/to/sentry-javascript/packages/hub'
118+
* '@sentry/react': 'path/to/sentry-javascript/packages/react'
119119
*
120120
* When using bundled versions of the tracing and browser packages, all aliases look for example like
121121
* '@sentry/browser': false

dev-packages/e2e-tests/test-applications/generic-ts3.8/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import * as _SentryBrowser from '@sentry/browser';
33
// biome-ignore lint/nursery/noUnusedImports:
44
import * as _SentryCore from '@sentry/core';
55
// biome-ignore lint/nursery/noUnusedImports:
6-
import * as _SentryHub from '@sentry/hub';
7-
// biome-ignore lint/nursery/noUnusedImports:
86
import * as _SentryIntegrations from '@sentry/integrations';
97
// biome-ignore lint/nursery/noUnusedImports:
108
import * as _SentryNode from '@sentry/node';

dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"dependencies": {
1616
"@sentry/browser": "latest || *",
1717
"@sentry/core": "latest || *",
18-
"@sentry/hub": "latest || *",
1918
"@sentry/integrations": "latest || *",
2019
"@sentry/node": "latest || *",
2120
"@sentry/opentelemetry-node": "latest || *",

dev-packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ packages:
8686
unpublish: $all
8787
# proxy: npmjs # Don't proxy for E2E tests!
8888

89-
'@sentry/hub':
90-
access: $all
91-
publish: $all
92-
unpublish: $all
93-
# proxy: npmjs # Don't proxy for E2E tests!
94-
9589
'@sentry/integrations':
9690
access: $all
9791
publish: $all

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ export function makeTSPlugin(jsVersion) {
157157
paths: {
158158
'@sentry/browser': ['../browser/src'],
159159
'@sentry/core': ['../core/src'],
160-
'@sentry/hub': ['../hub/src'],
161160
'@sentry/types': ['../types/src'],
162161
'@sentry/utils': ['../utils/src'],
163162
'@sentry-internal/integration-shims': ['../integration-shims/src'],

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"packages/eslint-plugin-sdk",
5858
"packages/feedback",
5959
"packages/gatsby",
60-
"packages/hub",
6160
"packages/integrations",
6261
"packages/integration-shims",
6362
"packages/nextjs",

packages/astro/src/index.server.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ export {
4646
setTag,
4747
setTags,
4848
setUser,
49-
// eslint-disable-next-line deprecation/deprecation
50-
spanStatusfromHttpCode,
5149
getSpanStatusFromHttpCode,
5250
setHttpStatus,
5351
// eslint-disable-next-line deprecation/deprecation
@@ -68,8 +66,6 @@ export {
6866
addRequestDataToEvent,
6967
DEFAULT_USER_INCLUDES,
7068
extractRequestData,
71-
// eslint-disable-next-line deprecation/deprecation
72-
deepReadDirSync,
7369
Integrations,
7470
consoleIntegration,
7571
onUncaughtExceptionIntegration,

packages/browser/src/exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ export { linkedErrorsIntegration } from './integrations/linkederrors';
109109
export { browserApiErrorsIntegration } from './integrations/trycatch';
110110

111111
// eslint-disable-next-line deprecation/deprecation
112-
export { GlobalHandlers, TryCatch, Breadcrumbs, LinkedErrors, HttpContext, Dedupe } from './integrations';
112+
export { TryCatch, Breadcrumbs, LinkedErrors, HttpContext, Dedupe } from './integrations';

packages/browser/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ export {
7171
extractTraceparentData,
7272
// eslint-disable-next-line deprecation/deprecation
7373
getActiveTransaction,
74-
// eslint-disable-next-line deprecation/deprecation
75-
spanStatusfromHttpCode,
7674
getSpanStatusFromHttpCode,
7775
setHttpStatus,
7876
// eslint-disable-next-line deprecation/deprecation

packages/browser/src/integrations/globalhandlers.ts

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2-
import { captureEvent, convertIntegrationFnToClass, defineIntegration, getClient } from '@sentry/core';
3-
import type {
4-
Client,
5-
Event,
6-
Integration,
7-
IntegrationClass,
8-
IntegrationFn,
9-
Primitive,
10-
StackParser,
11-
} from '@sentry/types';
1+
import { captureEvent, defineIntegration, getClient } from '@sentry/core';
2+
import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/types';
123
import {
134
addGlobalErrorInstrumentationHandler,
145
addGlobalUnhandledRejectionInstrumentationHandler,
156
getLocationHref,
16-
isErrorEvent,
177
isPrimitive,
188
isString,
199
logger,
@@ -57,18 +47,6 @@ const _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations
5747

5848
export const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);
5949

60-
/**
61-
* Global handlers.
62-
* @deprecated Use `globalHandlersIntegration()` instead.
63-
*/
64-
// eslint-disable-next-line deprecation/deprecation
65-
export const GlobalHandlers = convertIntegrationFnToClass(
66-
INTEGRATION_NAME,
67-
globalHandlersIntegration,
68-
) as IntegrationClass<Integration & { setup: (client: Client) => void }> & {
69-
new (options?: Partial<GlobalHandlersIntegrations>): Integration;
70-
};
71-
7250
function _installGlobalOnErrorHandler(client: Client): void {
7351
addGlobalErrorInstrumentationHandler(data => {
7452
const { stackParser, attachStacktrace } = getOptions();
@@ -79,15 +57,12 @@ function _installGlobalOnErrorHandler(client: Client): void {
7957

8058
const { msg, url, line, column, error } = data;
8159

82-
const event =
83-
error === undefined && isString(msg)
84-
? _eventFromIncompleteOnError(msg, url, line, column)
85-
: _enhanceEventWithInitialFrame(
86-
eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),
87-
url,
88-
line,
89-
column,
90-
);
60+
const event = _enhanceEventWithInitialFrame(
61+
eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),
62+
url,
63+
line,
64+
column,
65+
);
9166

9267
event.level = 'error';
9368

@@ -132,24 +107,23 @@ function _getUnhandledRejectionError(error: unknown): unknown {
132107
return error;
133108
}
134109

135-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
136-
const e = error as any;
137-
138110
// dig the object of the rejection out of known event types
139111
try {
112+
type ErrorWithReason = { reason: unknown };
140113
// PromiseRejectionEvents store the object of the rejection under 'reason'
141114
// see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
142-
if ('reason' in e) {
143-
return e.reason;
115+
if ('reason' in (error as ErrorWithReason)) {
116+
return (error as ErrorWithReason).reason;
144117
}
145118

119+
type CustomEventWithDetail = { detail: { reason: unknown } };
146120
// something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents
147121
// to CustomEvents, moving the `promise` and `reason` attributes of the PRE into
148122
// the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec
149123
// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and
150124
// https://github.com/getsentry/sentry-javascript/issues/2380
151-
else if ('detail' in e && 'reason' in e.detail) {
152-
return e.detail.reason;
125+
if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {
126+
return (error as CustomEventWithDetail).detail.reason;
153127
}
154128
} catch {} // eslint-disable-line no-empty
155129

@@ -176,38 +150,6 @@ function _eventFromRejectionWithPrimitive(reason: Primitive): Event {
176150
};
177151
}
178152

179-
/**
180-
* This function creates a stack from an old, error-less onerror handler.
181-
*/
182-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
183-
function _eventFromIncompleteOnError(msg: any, url: any, line: any, column: any): Event {
184-
const ERROR_TYPES_RE =
185-
/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
186-
187-
// If 'message' is ErrorEvent, get real message from inside
188-
let message = isErrorEvent(msg) ? msg.message : msg;
189-
let name = 'Error';
190-
191-
const groups = message.match(ERROR_TYPES_RE);
192-
if (groups) {
193-
name = groups[1];
194-
message = groups[2];
195-
}
196-
197-
const event = {
198-
exception: {
199-
values: [
200-
{
201-
type: name,
202-
value: message,
203-
},
204-
],
205-
},
206-
};
207-
208-
return _enhanceEventWithInitialFrame(event, url, line, column);
209-
}
210-
211153
// eslint-disable-next-line @typescript-eslint/no-explicit-any
212154
function _enhanceEventWithInitialFrame(event: Event, url: any, line: any, column: any): Event {
213155
// event.exception

packages/browser/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable deprecation/deprecation */
2-
export { GlobalHandlers } from './globalhandlers';
32
export { TryCatch } from './trycatch';
43
export { Breadcrumbs } from './breadcrumbs';
54
export { LinkedErrors } from './linkederrors';

packages/bun/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ export {
6464
setTag,
6565
setTags,
6666
setUser,
67-
// eslint-disable-next-line deprecation/deprecation
68-
spanStatusfromHttpCode,
6967
getSpanStatusFromHttpCode,
7068
setHttpStatus,
7169
// eslint-disable-next-line deprecation/deprecation
@@ -89,8 +87,6 @@ export {
8987
} from '@sentry/core';
9088
export type { SpanStatusType } from '@sentry/core';
9189
export {
92-
// eslint-disable-next-line deprecation/deprecation
93-
deepReadDirSync,
9490
// eslint-disable-next-line deprecation/deprecation
9591
enableAnrDetection,
9692
// eslint-disable-next-line deprecation/deprecation

packages/core/src/tracing/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ export { extractTraceparentData, getActiveTransaction } from './utils';
99
export { SpanStatus } from './spanstatus';
1010
export {
1111
setHttpStatus,
12-
// eslint-disable-next-line deprecation/deprecation
13-
spanStatusfromHttpCode,
1412
getSpanStatusFromHttpCode,
1513
} from './spanstatus';
1614
export type { SpanStatusType } from './spanstatus';

packages/core/src/tracing/spanstatus.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,6 @@ export function getSpanStatusFromHttpCode(httpStatus: number): SpanStatusType {
123123
return 'unknown_error';
124124
}
125125

126-
/**
127-
* Converts a HTTP status code into a {@link SpanStatusType}.
128-
*
129-
* @deprecated Use {@link spanStatusFromHttpCode} instead.
130-
* This export will be removed in v8 as the signature contains a typo.
131-
*
132-
* @param httpStatus The HTTP response status code.
133-
* @returns The span status or unknown_error.
134-
*/
135-
export const spanStatusfromHttpCode = getSpanStatusFromHttpCode;
136-
137126
/**
138127
* Sets the Http status attributes on the current span based on the http code.
139128
* Additionally, the span's status is updated, depending on the http code.

0 commit comments

Comments
 (0)