node.js - Apollo Federation - 处理错误 Entity -> `Entity` 是扩展类型,但 `Entity` 未在任何服务中定义
问题描述
我想知道是否有机会处理 Apollo Federation 错误:Apollo Federation - Hadling the error Entity -> Entity
is an extension type, but Entity
is not defined in any service
场景:在我的服务“LocalizationService”中,我扩展了“Productservice”的实体“Product”,如下所示:
@Directive('@extends')
@Directive('@key(fields: "id")')
export default class Product {
@Directive('@external')
@Field(() => ID)
id!: number
}
如果服务“Productservice”宕机了怎么办?我得到了错误:
Product -> `Product` is an extension type, but `Product` is not defined in any service
有没有办法捕获该错误或以某种方式将实体设置为可为空?