diff options
| author | Charlotte Koch <charlotte@magentastripe.com> | 2023-10-24 12:07:40 -0700 |
|---|---|---|
| committer | Charlotte Koch <dressupgeekout@gmail.com> | 2023-10-24 12:07:40 -0700 |
| commit | 61b79b83cd227340488e69465cb50df4a0a309f5 (patch) | |
| tree | 5f7c1d6bb089a49ca93cebc4512d2027bf84176a | |
| parent | a2622a3e72167ca16899e30cd94680b29feab3e8 (diff) | |
Error out if trying to order nonexistent product
| -rw-r--r-- | packingslip.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packingslip.rb b/packingslip.rb index fa56b84..7373222 100644 --- a/packingslip.rb +++ b/packingslip.rb @@ -110,6 +110,10 @@ class MagentaStripeMedia::Manifest catalog_no = sprintf("MSM-%05d", data["catalog_no"]) the_product = @catalog.detect { |product| product["CATALOG-NO"] == catalog_no } + if !the_product + die("cannot find product with number #{catalog_no} in catalog #{kwargs[:catalog_data]}") + end + item = MagentaStripeMedia::Item.new item.catalog_no = catalog_no item.name = the_product["TITLE"] |
