Skip to content

Commit 3ea8d40

Browse files
committed
fix: Normalize data before passing it to transport
1 parent 3c45c2f commit 3ea8d40

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
- [core] feat: Deprecate `captureEvent`, prefer `sendEvent` for transports. `sendEvent` now takes a string (body)
66
instead of `Event` object.
77
- [core] feat: Use correct buffer for requests in transports
8-
- [node] feat: Add file cache for providing pre/post context in frames
9-
- [node] feat: New option `frameContextLines`, if set to `0` we do not provide source code pre/post context, default is
10-
`7` lines pre/post
118
- [core]: ref: Change way how transports are initialized
129
- [core]: ref: Rename `RequestBuffer` to `PromiseBuffer`, also introduce limit
10+
- [core]: fix: Check if value is error object in extraErrorData integration
1311
- [browser] fix: Prevent empty exception values
12+
- [browser]: fix: Permission denied to access property name
13+
- [node] feat: Add file cache for providing pre/post context in frames
14+
- [node] feat: New option `frameContextLines`, if set to `0` we do not provide source code pre/post context, default is
15+
`7` lines pre/post
16+
- [utils] fix: Use custom serializer inside `serialize` method to prevent circular references
1417

1518
## 4.4.2
1619

packages/browser/src/integrations/trycatch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,12 @@ export class TryCatch implements Integration {
210210
}
211211
}
212212

213+
/**
214+
* Safely extract function name from itself
215+
*/
213216
function getFunctionName(fn: any): string {
214217
try {
215-
return fn && fn.name || '<anonymous>';
218+
return (fn && fn.name) || '<anonymous>';
216219
} catch (e) {
217220
// Just accessing custom props in some Selenium environments
218221
// can cause a "Permission denied" exception (see raven-js#495).

packages/utils/src/object.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ interface ExtendedError extends Error {
1111
/**
1212
* Serializes the given object into a string.
1313
* Like JSON.stringify, but doesn't throw on circular references.
14-
* Based on a `json-stringify-safe` package and modified to handle Errors serialization.
15-
*
16-
* The object must be serializable, i.e.:
17-
* - Only primitive types are allowed (object, array, number, string, boolean)
18-
* - Its depth should be considerably low for performance reasons
14+
* and modified to handle Errors and "unserializable values" serialization.
1915
*
2016
* @param object A JSON-serializable object.
2117
* @returns A string containing the serialized object.
2218
*/
2319
export function serialize<T>(object: T): string {
24-
return JSON.stringify(object);
20+
return JSON.stringify(object, standardizer());
2521
}
2622

2723
/**

0 commit comments

Comments
 (0)