@naturalcycles/backend-lib 4.5.3 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,9 +27,9 @@ export declare class SentrySharedService {
|
|
|
27
27
|
setUserId(id: string): void;
|
|
28
28
|
/**
|
|
29
29
|
* Does console.error(err)
|
|
30
|
-
* Returns "eventId"
|
|
30
|
+
* Returns "eventId" or undefined (if error was not reported).
|
|
31
31
|
*/
|
|
32
|
-
captureException(err: any, logError?: boolean): string;
|
|
32
|
+
captureException(err: any, logError?: boolean): string | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* Returns "eventId"
|
|
35
35
|
*/
|
|
@@ -64,7 +64,7 @@ class SentrySharedService {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Does console.error(err)
|
|
67
|
-
* Returns "eventId"
|
|
67
|
+
* Returns "eventId" or undefined (if error was not reported).
|
|
68
68
|
*/
|
|
69
69
|
captureException(err, logError = true) {
|
|
70
70
|
// console.error(err)
|
|
@@ -72,7 +72,11 @@ class SentrySharedService {
|
|
|
72
72
|
if (logError) {
|
|
73
73
|
(0, index_1.getRequestLogger)().error('captureException:', err);
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
if (err?.data?.report === false) {
|
|
76
|
+
// Skip reporting the error
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// This is to avoid Sentry cutting err.message to 253 characters
|
|
76
80
|
// It will log additional "breadcrumb object" before the error
|
|
77
81
|
// It's a Breadcrumb, not a console.log, because console.log are NOT automatically attached as Breadcrumbs in cron-job environments (outside of Express)
|
|
78
82
|
this.sentry().addBreadcrumb({
|
package/package.json
CHANGED
|
@@ -74,16 +74,21 @@ export class SentrySharedService {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Does console.error(err)
|
|
77
|
-
* Returns "eventId"
|
|
77
|
+
* Returns "eventId" or undefined (if error was not reported).
|
|
78
78
|
*/
|
|
79
|
-
captureException(err: any, logError = true): string {
|
|
79
|
+
captureException(err: any, logError = true): string | undefined {
|
|
80
80
|
// console.error(err)
|
|
81
81
|
// Using request-aware logger here
|
|
82
82
|
if (logError) {
|
|
83
83
|
getRequestLogger().error('captureException:', err)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
if (err?.data?.report === false) {
|
|
87
|
+
// Skip reporting the error
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// This is to avoid Sentry cutting err.message to 253 characters
|
|
87
92
|
// It will log additional "breadcrumb object" before the error
|
|
88
93
|
// It's a Breadcrumb, not a console.log, because console.log are NOT automatically attached as Breadcrumbs in cron-job environments (outside of Express)
|
|
89
94
|
this.sentry().addBreadcrumb({
|