File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
packages/core/framework/src/http Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,14 @@ import express from "express"
99import querystring from "querystring"
1010import supertest from "supertest"
1111
12- import { config } from "../mocks"
1312import { MedusaContainer } from "@medusajs/types"
1413import { configManager } from "../../../config"
1514import { container } from "../../../container"
1615import { featureFlagsLoader } from "../../../feature-flags"
1716import { logger } from "../../../logger"
18- import { MedusaRequest } from "../../types"
1917import { ApiLoader } from "../../router"
18+ import { MedusaRequest } from "../../types"
19+ import { config } from "../mocks"
2020
2121function asArray ( resolvers ) {
2222 return {
@@ -69,6 +69,7 @@ export const createServer = async (rootDir) => {
6969 container . register ( {
7070 logger : asValue ( {
7171 error : ( ) => { } ,
72+ info : ( ) => { } ,
7273 } ) ,
7374 manager : asValue ( { } ) ,
7475 } )
Original file line number Diff line number Diff line change 1+ import { ErrorRequestHandler , NextFunction , Response } from "express"
12import { fromZodIssue } from "zod-validation-error"
2- import { NextFunction , ErrorRequestHandler , Response } from "express"
33
44import { ContainerRegistrationKeys , MedusaError } from "@medusajs/utils"
5- import { formatException } from "./exception-formatter"
65import { MedusaRequest } from "../types"
6+ import { formatException } from "./exception-formatter"
77
88const QUERY_RUNNER_RELEASED = "QueryRunnerAlreadyReleasedError"
99const TRANSACTION_STARTED = "TransactionAlreadyStartedError"
@@ -31,7 +31,6 @@ export function errorHandler() {
3131 }
3232
3333 err = formatException ( err )
34- logger . error ( err )
3534
3635 const errorType = err . type || err . name
3736 const errObj = {
@@ -82,6 +81,12 @@ export function errorHandler() {
8281 break
8382 }
8483
84+ if ( statusCode >= 500 ) {
85+ logger . error ( err )
86+ } else {
87+ logger . info ( err . message )
88+ }
89+
8590 if ( "issues" in err && Array . isArray ( err . issues ) ) {
8691 const messages = err . issues . map ( ( issue ) => fromZodIssue ( issue ) . toString ( ) )
8792 res . status ( statusCode ) . json ( {
You can’t perform that action at this time.
0 commit comments