diff --git a/.changeset/fast-taxis-behave.md b/.changeset/fast-taxis-behave.md new file mode 100644 index 000000000..eb73a09d9 --- /dev/null +++ b/.changeset/fast-taxis-behave.md @@ -0,0 +1,5 @@ +--- +"@osdk/foundry-sdk-generator": patch +--- + +Better error handling around server errors when getting ontology metadata diff --git a/packages/foundry-sdk-generator/src/ontologyMetadata/ontologyMetadataResolver.ts b/packages/foundry-sdk-generator/src/ontologyMetadata/ontologyMetadataResolver.ts index b0491edba..3430f89e1 100644 --- a/packages/foundry-sdk-generator/src/ontologyMetadata/ontologyMetadataResolver.ts +++ b/packages/foundry-sdk-generator/src/ontologyMetadata/ontologyMetadataResolver.ts @@ -131,6 +131,14 @@ export class OntologyMetadataResolver { ontology.apiName, ); + if ((ontologyFullMetadata as any).errorName != null) { + return Result.err([ + `Unable to load the specified Ontology metadata.\n${ + JSON.stringify(ontologyFullMetadata, null, 2) + }`, + ]); + } + const linkTypes = new Map>(); const objectTypes = new Set( entities.objectTypesApiNamesToLoad?.map(object => object.toLowerCase()),