Skip to content

Commit

Permalink
Optimize the response
Browse files Browse the repository at this point in the history
Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong committed Dec 2, 2024
1 parent fcbd5d2 commit 035d673
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions server/routes/text2viz_routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,20 @@ export function registerText2VizRoutes(router: IRouter, assistantService: Assist
}
return res.badRequest();
} catch (e) {
return res.customError({
body: e.body || 'execute agent failed',
statusCode: e.statusCode || 500,
headers: e.headers,
});
context.assistant_plugin.logger.error('Execute agent failed!', e);
if (e.statusCode >= 400 && e.statusCode <= 499) {
return res.customError({
body: e.body,
statusCode: e.statusCode,
headers: e.headers,
});
} else {
return res.customError({
body: 'Execute agent failed!',
statusCode: 500,
headers: e.headers,
});
}
}
})
);
Expand Down

0 comments on commit 035d673

Please sign in to comment.