-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Truncate stack when application_error stack trace exceeds 8kb (close #…
- Loading branch information
1 parent
9fe9ee9
commit 97aa82b
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...wplow/browser-plugin-error-tracking/issue-1327_truncate-stack-trace_2024-07-16-10-59.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@snowplow/browser-plugin-error-tracking", | ||
"comment": "Truncate error stack trace if it's size is greater than 8kb", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@snowplow/browser-plugin-error-tracking" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Truncate string if it's longer than 8192 chars | ||
* | ||
* @param string - The stack trace to truncate | ||
* @param maxLength - The maximum length of the truncated string. Default = 8192 | ||
* @returns The truncated string | ||
*/ | ||
export function truncateString(string?: string, maxLength: number = 8192): string | undefined { | ||
if (string && string.length > maxLength) { | ||
const truncatedString = string.substring(0, maxLength); | ||
return truncatedString; | ||
} | ||
|
||
return string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters