Skip to content

Commit 850f1bb

Browse files
committed
deprecate it..
1 parent 0869503 commit 850f1bb

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

dev-packages/e2e-tests/test-applications/nuxt-3/server/plugins/customNitroErrorHandler.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Context, GLOBAL_OBJ, dropUndefinedKeys, flush, logger, vercelWaitUntil } from '@sentry/core';
1+
import { Context, GLOBAL_OBJ, flush, logger, vercelWaitUntil } from '@sentry/core';
22
import * as SentryNode from '@sentry/node';
33
import { H3Error } from 'h3';
44
import type { CapturedErrorContext } from 'nitropack';
@@ -36,24 +36,22 @@ export default defineNitroPlugin(nitroApp => {
3636
});
3737

3838
function extractErrorContext(errorContext: CapturedErrorContext): Context {
39-
const structuredContext: Context = {
40-
method: undefined,
41-
path: undefined,
42-
tags: undefined,
43-
};
39+
const ctx: Context = {};
4440

45-
if (errorContext) {
46-
if (errorContext.event) {
47-
structuredContext.method = errorContext.event._method || undefined;
48-
structuredContext.path = errorContext.event._path || undefined;
49-
}
41+
if (!errorContext) {
42+
return ctx;
43+
}
5044

51-
if (Array.isArray(errorContext.tags)) {
52-
structuredContext.tags = errorContext.tags || undefined;
53-
}
45+
if (errorContext.event) {
46+
ctx.method = errorContext.event._method;
47+
ctx.path = errorContext.event._path;
48+
}
49+
50+
if (Array.isArray(errorContext.tags)) {
51+
ctx.tags = errorContext.tags;
5452
}
5553

56-
return dropUndefinedKeys(structuredContext);
54+
return ctx;
5755
}
5856

5957
async function flushIfServerless(): Promise<void> {

packages/core/src/utils-hoist/anr.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { StackFrame } from '../types-hoist';
22
import { filenameIsInApp } from './node-stack-trace';
3-
import { dropUndefinedKeys } from './object';
43
import { UNKNOWN_FUNCTION } from './stacktrace';
54

65
type WatchdogReturn = {

packages/core/src/utils-hoist/envelope.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818

1919
import { dsnToString } from './dsn';
2020
import { normalize } from './normalize';
21-
import { dropUndefinedKeys } from './object';
2221
import { GLOBAL_OBJ } from './worldwide';
2322

2423
/**

packages/core/src/utils-hoist/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize';
4545
export {
4646
addNonEnumerableProperty,
4747
convertToPlainObject,
48+
// eslint-disable-next-line deprecation/deprecation
4849
dropUndefinedKeys,
4950
extractExceptionKeysForMessage,
5051
fill,

packages/core/src/utils-hoist/object.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ export function extractExceptionKeysForMessage(exception: Record<string, unknown
210210
* Works recursively on objects and arrays.
211211
*
212212
* Attention: This function keeps circular references in the returned object.
213+
*
214+
* @deprecated This function is no longer used by the SDK and will be removed in a future major version.
213215
*/
214216
export function dropUndefinedKeys<T>(inputValue: T): T {
215217
// This map keeps track of what already visited nodes map to.

packages/core/src/utils/request.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { PolymorphicRequest, RequestEventData } from '../types-hoist';
22
import type { WebFetchHeaders, WebFetchRequest } from '../types-hoist/webfetchapi';
3-
import { dropUndefinedKeys } from '../utils-hoist/object';
43

54
/**
65
* Transforms a `Headers` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into a simple key-value dict.

packages/core/test/utils-hoist/object.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ describe('extractExceptionKeysForMessage()', () => {
169169
});
170170
});
171171

172+
/* eslint-disable deprecation/deprecation */
172173
describe('dropUndefinedKeys()', () => {
173174
test('simple case', () => {
174175
expect(
@@ -314,6 +315,7 @@ describe('dropUndefinedKeys()', () => {
314315
expect(droppedChicken.lays[0] === droppedChicken).toBe(true);
315316
});
316317
});
318+
/* eslint-enable deprecation/deprecation */
317319

318320
describe('objectify()', () => {
319321
describe('stringifies nullish values', () => {

0 commit comments

Comments
 (0)