Skip to content

Commit 0fc10b0

Browse files
authored
fix(api): improve empty value assertion (#6728)
1 parent 9ee3c8e commit 0fc10b0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/services/api/src/modules/schema/providers/registry-checks.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ export function detectUrlChanges(
765765
const before = nameToCompositeSchemaMap.get(schema.service_name);
766766

767767
if (before && before.service_url !== schema.service_url) {
768-
if (before.service_url && schema.service_url) {
768+
if (before.service_url != null && schema.service_url != null) {
769769
changes.push({
770770
type: 'REGISTRY_SERVICE_URL_CHANGED',
771771
meta: {
@@ -776,7 +776,7 @@ export function detectUrlChanges(
776776
},
777777
},
778778
});
779-
} else if (before.service_url && schema.service_url == null) {
779+
} else if (before.service_url != null && schema.service_url == null) {
780780
changes.push({
781781
type: 'REGISTRY_SERVICE_URL_CHANGED',
782782
meta: {
@@ -787,7 +787,7 @@ export function detectUrlChanges(
787787
},
788788
},
789789
});
790-
} else if (before.service_url == null && schema.service_url) {
790+
} else if (before.service_url == null && schema.service_url != null) {
791791
changes.push({
792792
type: 'REGISTRY_SERVICE_URL_CHANGED',
793793
meta: {
@@ -799,7 +799,9 @@ export function detectUrlChanges(
799799
},
800800
});
801801
} else {
802-
throw new Error("This shouldn't happen.");
802+
throw new Error(
803+
`This shouldn't happen (before.service_url=${JSON.stringify(before.service_url)}, schema.service_url=${JSON.stringify(schema.service_url)}).`,
804+
);
803805
}
804806
}
805807
}

0 commit comments

Comments
 (0)