feat: Normalize known DB errors to a MedusaError when possible (#6922)

Before we would swallow the error and return a generic error to the user. This will provide more information to the caller if it is one of the known errors.
This commit is contained in:
Stevche Radevski
2024-04-04 21:12:59 +02:00
committed by GitHub
parent e944a627f0
commit 20e8df914e
14 changed files with 282 additions and 169 deletions
@@ -83,7 +83,7 @@ medusaIntegrationTestRunner({
})
})
it("should throw error when shipping option does not exist", async () => {
it.only("should throw error when shipping option does not exist", async () => {
const { response } = await api
.post(
`/admin/fulfillment/shipping-options/does-not-exist/rules/batch/add`,
@@ -100,7 +100,7 @@ medusaIntegrationTestRunner({
expect(response.data).toEqual({
type: "not_found",
message:
"Shipping_option with shipping_option_id does-not-exist does not exist.",
"You tried to set relationship shipping_option_id: does-not-exist, but such entity does not exist",
})
})