-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: Provide normalizeDepth option and sensible default for scope methods #2404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👍🏻 |
cdda656
to
e562bc5
Compare
extra: { | ||
arguments: normalize(handlerData.args, 3), | ||
}, | ||
arguments: handlerData.args, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is "kinda" breaking if someone is relying on such an odd data point, but if we won't change it, it'll have same issue as the one described for ExtractErrorData
@@ -115,7 +115,7 @@ export class Scope implements ScopeInterface { | |||
* @inheritDoc | |||
*/ | |||
public setUser(user: User | null): this { | |||
this._user = normalize(user); | |||
this._user = user || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation here was incorrect from the beginning. normalize
returned any
, so we did this._user = <any>
, which shouldn't be allowed, as this._user
is a non-optional User
type. Also, clear
sets it to {}
not null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit + Changelog please.
Otherwise LGTM
f0a2d9a
to
234845f
Compare
The initial issue wasn't with an incorrect circular algorithm implementation. It was with recursive references with a large payload, that were outgrowing the stack.
The most basic way to crash it:
The only notable change here is a conflict with
ExtractErrorData
that keeps error details one level deeper than regular "scope data", eg.contexts.errorName.data
, notcontexts.key
so it's owndepth
option will be effectively ignored whennormalizeDepth
value is smaller.Similar thing would happen for console breadcrumbs integration, as it keeps the data in
breadcrumb.data.arguments
, but because I only normalizebreadcrumb.data
, it doesn't affect it.Fixes #2178
Fixes #2311
Fixes #2359
Fixes #2366
Fixes #2375