@skmtc/core 0.47.2 → 0.47.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.
|
@@ -514,14 +514,31 @@ export class ParseContext {
|
|
|
514
514
|
logIssueAt(issue, parent) {
|
|
515
515
|
const added = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_addIssue).call(this, toParseIssue(issue));
|
|
516
516
|
if (added && !this.silent) {
|
|
517
|
-
|
|
517
|
+
const payload = {
|
|
518
518
|
protocol: issue.protocol,
|
|
519
519
|
level: issue.level,
|
|
520
520
|
location: issue.location,
|
|
521
521
|
message: issue.message,
|
|
522
522
|
type: issue.type,
|
|
523
523
|
...(parent === undefined ? {} : { parent: JSON.stringify(parent) })
|
|
524
|
-
}
|
|
524
|
+
};
|
|
525
|
+
// Each issue is logged at its own level, so a log threshold above
|
|
526
|
+
// DEBUG leaves `debug` issues out.
|
|
527
|
+
switch (issue.level) {
|
|
528
|
+
case 'error':
|
|
529
|
+
this.logger.error(payload);
|
|
530
|
+
break;
|
|
531
|
+
case 'warning':
|
|
532
|
+
this.logger.warn(payload);
|
|
533
|
+
break;
|
|
534
|
+
case 'debug':
|
|
535
|
+
this.logger.debug(payload);
|
|
536
|
+
break;
|
|
537
|
+
default: {
|
|
538
|
+
const _exhaustive = issue;
|
|
539
|
+
throw new Error(`Unhandled issue level: ${JSON.stringify(_exhaustive)}`);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
525
542
|
}
|
|
526
543
|
}
|
|
527
544
|
// -- OAS-flavored surface (StackTrail-based) ---------------------
|
|
@@ -755,25 +772,26 @@ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMa
|
|
|
755
772
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
756
773
|
const at = rootCause.location === undefined ? '' : ` at '${rootCause.location}'`;
|
|
757
774
|
const message = `Depends on '${refKey}', removed because of the error${at}: ${errorMessage}`;
|
|
775
|
+
// `logIssueAt` serializes the cause and picks the issue's protocol shape.
|
|
758
776
|
switch (this.protocol.type) {
|
|
759
777
|
case 'oas':
|
|
760
|
-
|
|
778
|
+
this.logIssueAt({
|
|
761
779
|
protocol: 'oas',
|
|
762
780
|
level: 'error',
|
|
763
781
|
type: 'INVALID_DEPENDENCY_REF',
|
|
764
782
|
location,
|
|
765
783
|
message,
|
|
766
|
-
cause:
|
|
784
|
+
cause: error
|
|
767
785
|
});
|
|
768
786
|
break;
|
|
769
787
|
case 'gql':
|
|
770
|
-
|
|
788
|
+
this.logIssueAt({
|
|
771
789
|
protocol: 'gql',
|
|
772
790
|
level: 'error',
|
|
773
791
|
type: 'INVALID_DEPENDENCY_REF',
|
|
774
792
|
location,
|
|
775
793
|
message,
|
|
776
|
-
cause:
|
|
794
|
+
cause: error
|
|
777
795
|
});
|
|
778
796
|
break;
|
|
779
797
|
default: {
|
package/package.json
CHANGED
|
@@ -517,14 +517,31 @@ class ParseContext {
|
|
|
517
517
|
logIssueAt(issue, parent) {
|
|
518
518
|
const added = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_addIssue).call(this, toParseIssue(issue));
|
|
519
519
|
if (added && !this.silent) {
|
|
520
|
-
|
|
520
|
+
const payload = {
|
|
521
521
|
protocol: issue.protocol,
|
|
522
522
|
level: issue.level,
|
|
523
523
|
location: issue.location,
|
|
524
524
|
message: issue.message,
|
|
525
525
|
type: issue.type,
|
|
526
526
|
...(parent === undefined ? {} : { parent: JSON.stringify(parent) })
|
|
527
|
-
}
|
|
527
|
+
};
|
|
528
|
+
// Each issue is logged at its own level, so a log threshold above
|
|
529
|
+
// DEBUG leaves `debug` issues out.
|
|
530
|
+
switch (issue.level) {
|
|
531
|
+
case 'error':
|
|
532
|
+
this.logger.error(payload);
|
|
533
|
+
break;
|
|
534
|
+
case 'warning':
|
|
535
|
+
this.logger.warn(payload);
|
|
536
|
+
break;
|
|
537
|
+
case 'debug':
|
|
538
|
+
this.logger.debug(payload);
|
|
539
|
+
break;
|
|
540
|
+
default: {
|
|
541
|
+
const _exhaustive = issue;
|
|
542
|
+
throw new Error(`Unhandled issue level: ${JSON.stringify(_exhaustive)}`);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
528
545
|
}
|
|
529
546
|
}
|
|
530
547
|
// -- OAS-flavored surface (StackTrail-based) ---------------------
|
|
@@ -759,25 +776,26 @@ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMa
|
|
|
759
776
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
760
777
|
const at = rootCause.location === undefined ? '' : ` at '${rootCause.location}'`;
|
|
761
778
|
const message = `Depends on '${refKey}', removed because of the error${at}: ${errorMessage}`;
|
|
779
|
+
// `logIssueAt` serializes the cause and picks the issue's protocol shape.
|
|
762
780
|
switch (this.protocol.type) {
|
|
763
781
|
case 'oas':
|
|
764
|
-
|
|
782
|
+
this.logIssueAt({
|
|
765
783
|
protocol: 'oas',
|
|
766
784
|
level: 'error',
|
|
767
785
|
type: 'INVALID_DEPENDENCY_REF',
|
|
768
786
|
location,
|
|
769
787
|
message,
|
|
770
|
-
cause:
|
|
788
|
+
cause: error
|
|
771
789
|
});
|
|
772
790
|
break;
|
|
773
791
|
case 'gql':
|
|
774
|
-
|
|
792
|
+
this.logIssueAt({
|
|
775
793
|
protocol: 'gql',
|
|
776
794
|
level: 'error',
|
|
777
795
|
type: 'INVALID_DEPENDENCY_REF',
|
|
778
796
|
location,
|
|
779
797
|
message,
|
|
780
|
-
cause:
|
|
798
|
+
cause: error
|
|
781
799
|
});
|
|
782
800
|
break;
|
|
783
801
|
default: {
|