Skip to content

Commit 1e6dbb9

Browse files
committed
Do not crash on Domain annotations 404
1 parent d24d832 commit 1e6dbb9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/app/domain-annotations/prop.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace DomainAnnotations {
2828
return !!model && Model.hasPdbId(model);
2929
}
3030

31-
export function fromJson(model: Model, data: any) {
31+
export function fromJson(model: Model, data: any): DomainAnnotations {
3232
const info = PropertyWrapper.createInfo();
3333
const domainMap = createdomainMapFromJson(model, data);
3434
return { info, data: domainMap };
@@ -88,7 +88,12 @@ export const DomainAnnotationsProvider: CustomModelProperty.Provider<DomainAnnot
8888
isApplicable: (data: Model) => DomainAnnotations.isApplicable(data),
8989
obtain: async (ctx: CustomProperty.Context, data: Model, props: Partial<DomainAnnotationsProps>) => {
9090
const p = { ...PD.getDefaultValues(DomainAnnotationsParams), ...props };
91-
return await DomainAnnotations.fromServer(ctx, data, p);
91+
try {
92+
return await DomainAnnotations.fromServer(ctx, data, p);
93+
} catch {
94+
console.error('Could not obtain domain annotations');
95+
return { value: DomainAnnotations.fromJson(data, {}) };
96+
}
9297
},
9398
});
9499

0 commit comments

Comments
 (0)