File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/core/framework/src/http/middlewares Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { ErrorRequestHandler , NextFunction , Response } from "express"
1
2
import { fromZodIssue } from "zod-validation-error"
2
- import { NextFunction , ErrorRequestHandler , Response } from "express"
3
3
4
4
import { ContainerRegistrationKeys , MedusaError } from "@medusajs/utils"
5
- import { formatException } from "./exception-formatter"
6
5
import { MedusaRequest } from "../types"
6
+ import { formatException } from "./exception-formatter"
7
7
8
8
const QUERY_RUNNER_RELEASED = "QueryRunnerAlreadyReleasedError"
9
9
const TRANSACTION_STARTED = "TransactionAlreadyStartedError"
@@ -31,7 +31,6 @@ export function errorHandler() {
31
31
}
32
32
33
33
err = formatException ( err )
34
- logger . error ( err )
35
34
36
35
const errorType = err . type || err . name
37
36
const errObj = {
@@ -82,6 +81,10 @@ export function errorHandler() {
82
81
break
83
82
}
84
83
84
+ if ( statusCode >= 500 ) {
85
+ logger . error ( err )
86
+ }
87
+
85
88
if ( "issues" in err && Array . isArray ( err . issues ) ) {
86
89
const messages = err . issues . map ( ( issue ) => fromZodIssue ( issue ) . toString ( ) )
87
90
res . status ( statusCode ) . json ( {
You can’t perform that action at this time.
0 commit comments