Skip to content

CX Improper_Exception_Handling @ Controllers/ProductsController.cs [Merge_Branch]

Improper_Exception_Handling issue exists @ Controllers/ProductsController.cs in branch Merge_Branch

The method Post at line 43 of Controllers\ProductsController.cs performs an operation that could be expected to throw an exception, and is not properly wrapped in a try-catch block. This constitutes Improper Exception Handling.

Severity: Low

CWE:248

Checkmarx

Training Recommended Fix

Lines: 51 52 43


Code (Line #51):

         _context.Products.Add(product);

Code (Line #52):

         _context.SaveChanges();

Code (Line #43):

            Where(b => (b.name == product.name) || (b.skuId == product.skuId)).

Edited by Gabriel Prevelate