Skip to content

Commit 1e25416

Browse files
committed
Rollback error handling changes to http/middlewares/error.ts
1 parent 92657eb commit 1e25416

File tree

1 file changed

+6
-8
lines changed
  • src/service/worker/runtime/http/middlewares

1 file changed

+6
-8
lines changed

src/service/worker/runtime/http/middlewares/error.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AxiosError } from 'axios'
21
import { IOClients } from '../../../../../clients/IOClients'
32
import { LINKED } from '../../../../../constants'
43
import {
@@ -103,13 +102,12 @@ export async function error (ctx: ServiceContext, next: () => Promise<void>) {
103102
const err = cleanError(e)
104103

105104
// Add response
106-
if(e instanceof AxiosError){
107-
ctx.status = e?.status && e.status >= 400 && e.status <= 599
108-
? e.status
109-
: ctx.status >= 500 && ctx.status <= 599
110-
? ctx.status
111-
: 500
112-
}
105+
ctx.status = e?.status && e.status >= 400 && e.status <= 599
106+
? e.status
107+
: ctx.status >= 500 && ctx.status <= 599
108+
? ctx.status
109+
: 500
110+
113111
// Do not generate etag for errors
114112
ctx.remove(META_HEADER)
115113
ctx.remove(ETAG_HEADER)

0 commit comments

Comments
 (0)