diff --git a/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php b/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php index c2cdc90c..b46a2c85 100644 --- a/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php +++ b/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php @@ -3,7 +3,7 @@ namespace App\Endpoint\Api\Http\Controllers; use App\Endpoint\Api\Http\Resources\ShoppingCartItemResource; -use App\Exceptions\BizException; +use App\Exceptions\ProductOfflineException; use App\Models\ProductSku; use Illuminate\Http\Request; @@ -38,7 +38,7 @@ class ShoppingCartItemController extends Controller $sku = ProductSku::whereRelation('category', 'is_show', true)->online()->find($input['sku_id']); if ($sku === null) { - throw new BizException(__('Product has been removed')); + throw new ProductOfflineException(); } $item = $request->user()->shoppingCartItems()->firstOrCreate([ diff --git a/app/Exceptions/ProductOfflineException.php b/app/Exceptions/ProductOfflineException.php new file mode 100644 index 00000000..0e872059 --- /dev/null +++ b/app/Exceptions/ProductOfflineException.php @@ -0,0 +1,11 @@ +