Skip to content

Commit

Permalink
Error on invalid link args
Browse files Browse the repository at this point in the history
  • Loading branch information
jdolle committed Feb 3, 2025
1 parent 5789875 commit 78436c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/libraries/linkable-specs/src/link-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ export class FederatedLinkImport {

v.fields.forEach(f => {
if (f.name.value === 'name') {
name = (f.value as StringValueNode).value;
if (f.value.kind !== Kind.STRING) {
throw new Error(`Expected string value for "name" field but got "${f.value.kind}"`);
}
name = f.value.value;
} else if (f.name.value === 'as') {
as = (f.value as StringValueNode).value;
if (f.value.kind !== Kind.STRING) {
throw new Error(`Expected string value for "as" field but got "${f.value.kind}"`);
}
as = f.value.value;
}
});
return new FederatedLinkImport(name, as);
Expand Down

0 comments on commit 78436c8

Please sign in to comment.