如何为http错误添加信息?
想象一下以下情况:
服务B看起来像这样:
@Get()
async request() {
try {
const res = await this.httpsService.get("http://localhost:3000/account-worth").toPromise()
return res;
} catch (error) {
error.info = "Some Info" // Add some information to the error
return error;
}
}
在服务A中,我需要检索此信息。