Skip to content

Commit 1e887d3

Browse files
committed
erros; (#4)
1 parent 54d248b commit 1e887d3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/errors/customError.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default class CustomError extends Error {
2+
constructor(message, code, details = {}) {
3+
super(message);
4+
this.name = 'CustomError';
5+
this.code = code;
6+
this.details = details;
7+
}
8+
}
9+

src/errors/errorDictionary.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const ERROR_CODES = {
2+
PRODUCT_CREATION_ERROR: 'PRODUCT_CREATION_ERROR',
3+
PRODUCT_NOT_FOUND: 'PRODUCT_NOT_FOUND',
4+
CART_OPERATION_ERROR: 'CART_OPERATION_ERROR',
5+
INVALID_INPUT: 'INVALID_INPUT',
6+
};

0 commit comments

Comments
 (0)