This commit is contained in:
@@ -454,7 +454,7 @@ class OrderService extends BaseService {
|
||||
const exists = await this.existsByCartId(cart.id)
|
||||
if (exists) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_ARGUMENT,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
"Order from cart already exists"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class ProductVariantService extends BaseService {
|
||||
|
||||
if (variantExists) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
`Variant with title ${variantExists.title} with provided options already exists`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ class ProductService extends BaseService {
|
||||
|
||||
if (product.options.find(o => o.title === optionTitle)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
`An option with the title: ${optionTitle} already exists`
|
||||
)
|
||||
}
|
||||
@@ -631,7 +631,7 @@ class ProductService extends BaseService {
|
||||
if (!productOption) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_FOUND,
|
||||
`Option with id: ${optionId} deos not exists`
|
||||
`Option with id: ${optionId} does not exists`
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ class RegionService extends BaseService {
|
||||
|
||||
if (country.region_id && country.region_id !== regionId) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_ALLOWED,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
`${country.name} already exists in ${country.name}, delete it in that region before adding it`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ class ShippingOptionService extends BaseService {
|
||||
|
||||
if (option.requirements.find(r => r.type === validatedReq.type)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
`A requirement with type: ${validatedReq.type} already exists`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class StoreService extends BaseService {
|
||||
|
||||
if (store.currencies.map(c => c.code).includes(curr.code.toLowerCase())) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
`Currency already added`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ class SwapService extends BaseService {
|
||||
|
||||
if (swap.cart_id) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_ALLOWED,
|
||||
MedusaError.Types.DUPLICATE_ERROR,
|
||||
"A cart has already been created for the swap"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user