feat: In band inventory updates (#311)
Co-authored-by: olivermrbl <oliver@mrbltech.com>
This commit is contained in:
co-authored by
olivermrbl
parent
44fce520aa
commit
f07cc0fa40
@@ -12,6 +12,11 @@ export const MedusaErrorTypes = {
|
||||
NOT_ALLOWED: "not_allowed",
|
||||
}
|
||||
|
||||
export const MedusaErrorCodes = {
|
||||
INSUFFICIENT_INVENTORY: "insufficient_inventory",
|
||||
CART_INCOMPATIBLE_STATE: "cart_incompatible_state",
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardized error to be used across Medusa project.
|
||||
* @extends Error
|
||||
@@ -22,19 +27,22 @@ class MedusaError extends Error {
|
||||
* @param type {MedusaErrorType} - the type of error.
|
||||
* @param params {Array} - Error params.
|
||||
*/
|
||||
constructor(name, message, ...params) {
|
||||
constructor(type, message, code, ...params) {
|
||||
super(...params)
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, MedusaError)
|
||||
}
|
||||
|
||||
this.name = name
|
||||
this.type = type
|
||||
this.name = type
|
||||
this.code = code
|
||||
this.message = message
|
||||
this.date = new Date()
|
||||
}
|
||||
}
|
||||
|
||||
MedusaError.Types = MedusaErrorTypes
|
||||
MedusaError.Codes = MedusaErrorCodes
|
||||
|
||||
export default MedusaError
|
||||
|
||||
Reference in New Issue
Block a user