diff options
| author | Mhykol <mchaeldonald62@pm.me> | 2024-05-08 04:02:36 -0400 |
|---|---|---|
| committer | Mhykol <mchaeldonald62@pm.me> | 2024-05-08 04:02:36 -0400 |
| commit | 91b47111035e3af270bda77859fff82ccb774a12 (patch) | |
| tree | f0eab5b86c4ef159663c0ca3b8681d16db0e3552 /scripts/shop.js | |
| parent | 64cc512c47691825e7c31be3fc34f257b2f6f5df (diff) | |
Improve error handling and logging in database module
Diffstat (limited to 'scripts/shop.js')
| -rw-r--r-- | scripts/shop.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/shop.js b/scripts/shop.js index 87ddc0c..e75d289 100644 --- a/scripts/shop.js +++ b/scripts/shop.js @@ -18,12 +18,18 @@ class Shop { </section> ` } - for (let i = 0; i < output[0].length; i++) { - data.body += ` - <div class='item'> - <h2>${output[0][i].ProductName}</h2> - <p>ID: ${output[0][i].ID}</p> - </div> + if (output) { + for (let i = 0; i < output[0].length; i++) { + data.body += ` + <div class='item'> + <h2>${output[0][i].ProductName}</h2> + <p>ID: ${output[0][i].ID}</p> + </div> + ` + } + } else { + data.body = ` + There are no items in the database. ` } return data.start + data.body + data.end |
