Skip to content

Commit

Permalink
Merge pull request #44 from zulfikarrosadi/fix/products-update
Browse files Browse the repository at this point in the history
Fix/products update
  • Loading branch information
zulfikarrosadi authored Nov 21, 2024
2 parents 2db640e + 8767f01 commit 831f67f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/product/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class ProductService {
id: string,
data: UpdateProductDataService,
): Promise<ApiResponse<Product>> => {
const parsedId = BigInt(id)
try {
const parsedId = BigInt(id)
if (Number.isNaN(parsedId)) {
throw new NotFoundError(
"you are trying to update the product that doesn't exists",
Expand Down Expand Up @@ -197,6 +197,15 @@ class ProductService {
'updateProductById',
context,
)
if (error instanceof SyntaxError) {
return {
status: 'fail',
errors: {
code: 404,
message: 'fail to update product, product not found',
},
}
}
return {
status: 'fail',
errors: {
Expand Down

0 comments on commit 831f67f

Please # to comment.