@holo-js/kernel 0.4.3 → 0.4.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
70af129175e45d2957c43d206af49199f8364c3bcdd13c1604c1030bc4d4f763
|
|
@@ -14,18 +14,19 @@ function isUnreported(error, exceptions) {
|
|
|
14
14
|
return exceptions.dontReport?.some((errorClass) => error instanceof errorClass) ?? false;
|
|
15
15
|
}
|
|
16
16
|
function deliver(exceptions, error, context) {
|
|
17
|
-
if (exceptions && isUnreported(error, exceptions)) return;
|
|
17
|
+
if (exceptions && isUnreported(error, exceptions)) return Promise.resolve();
|
|
18
18
|
if (!exceptions?.report) {
|
|
19
19
|
console.error(describeContext(context), error);
|
|
20
|
-
return;
|
|
20
|
+
return Promise.resolve();
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
return Promise.resolve(exceptions.report(error, context)).catch((reporterError) => logReporterFailure(error, context, reporterError));
|
|
23
23
|
}
|
|
24
24
|
function reportWith(exceptions, error, context) {
|
|
25
25
|
try {
|
|
26
|
-
deliver(exceptions, error, context);
|
|
26
|
+
return deliver(exceptions, error, context);
|
|
27
27
|
} catch (reporterError) {
|
|
28
28
|
logReporterFailure(error, context, reporterError);
|
|
29
|
+
return Promise.resolve();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function configure(exceptions) {
|
|
@@ -35,11 +36,16 @@ function configure(exceptions) {
|
|
|
35
36
|
return previous;
|
|
36
37
|
}
|
|
37
38
|
function reportError(error, context) {
|
|
38
|
-
reportWith(errorReportingState().exceptions, error, context);
|
|
39
|
+
void reportWith(errorReportingState().exceptions, error, context);
|
|
40
|
+
}
|
|
41
|
+
function reportErrorAndWait(error, context) {
|
|
42
|
+
return reportWith(errorReportingState().exceptions, error, context);
|
|
39
43
|
}
|
|
40
44
|
function captureErrorReporter() {
|
|
41
45
|
const exceptions = errorReportingState().exceptions;
|
|
42
|
-
return (error, context) =>
|
|
46
|
+
return (error, context) => {
|
|
47
|
+
void reportWith(exceptions, error, context);
|
|
48
|
+
};
|
|
43
49
|
}
|
|
44
50
|
var errorReportingInternals = {
|
|
45
51
|
configure
|
|
@@ -47,6 +53,7 @@ var errorReportingInternals = {
|
|
|
47
53
|
|
|
48
54
|
export {
|
|
49
55
|
reportError,
|
|
56
|
+
reportErrorAndWait,
|
|
50
57
|
captureErrorReporter,
|
|
51
58
|
errorReportingInternals
|
|
52
59
|
};
|
|
@@ -10,10 +10,11 @@ interface HoloExceptionsConfig {
|
|
|
10
10
|
type HoloErrorReporter = (error: unknown, context: HoloErrorReportContext) => void;
|
|
11
11
|
declare function configure(exceptions: HoloExceptionsConfig | undefined): HoloExceptionsConfig | undefined;
|
|
12
12
|
declare function reportError(error: unknown, context: HoloErrorReportContext): void;
|
|
13
|
+
declare function reportErrorAndWait(error: unknown, context: HoloErrorReportContext): Promise<void>;
|
|
13
14
|
declare function captureErrorReporter(): HoloErrorReporter;
|
|
14
15
|
declare const errorReportingInternals: {
|
|
15
16
|
configure: typeof configure;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
export { captureErrorReporter, errorReportingInternals, reportError };
|
|
19
|
+
export { captureErrorReporter, errorReportingInternals, reportError, reportErrorAndWait };
|
|
19
20
|
export type { HoloErrorReportContext, HoloErrorReporter, HoloExceptionsConfig, HoloUnreportedErrorClass };
|
package/dist/error-reporting.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureErrorReporter,
|
|
3
3
|
errorReportingInternals,
|
|
4
|
-
reportError
|
|
5
|
-
|
|
4
|
+
reportError,
|
|
5
|
+
reportErrorAndWait
|
|
6
|
+
} from "./chunk-4NL655I5.mjs";
|
|
6
7
|
export {
|
|
7
8
|
captureErrorReporter,
|
|
8
9
|
errorReportingInternals,
|
|
9
|
-
reportError
|
|
10
|
+
reportError,
|
|
11
|
+
reportErrorAndWait
|
|
10
12
|
};
|