Skip to content

Commit

Permalink
feat: clip the axios error info
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteMinds committed Mar 10, 2024
1 parent 5d918c5 commit e8354c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/http-server/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export function createRouter(serverOpts: ServerOpts) {
router.use(loggerRoutes)

const handle: ErrorRequestHandler = (err: unknown, req, res, next) => {
// 裁剪体积过大的 AxiosError
if (err != null && typeof err === 'object' && 'isAxiosError' in err) {
delete err['request']
delete err['response']
}

logger.error('RouterError', err)
if (err instanceof Error) {
// respond(res, { error: err.message }).status(500)
Expand Down

0 comments on commit e8354c1

Please sign in to comment.