Merge pull request #4213 from nichwall/chapter_lookup_error_fix

Chapter lookup error interface update
This commit is contained in:
advplyr 2025-04-26 12:17:28 -05:00 committed by GitHub
commit be041f93c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 8 deletions

View file

@ -108,12 +108,12 @@ class SearchController {
async findChapters(req, res) {
const asin = req.query.asin
if (!isValidASIN(asin.toUpperCase())) {
return res.json({ error: 'Invalid ASIN' })
return res.json({ error: 'Invalid ASIN', stringKey: 'MessageInvalidAsin' })
}
const region = (req.query.region || 'us').toLowerCase()
const chapterData = await BookFinder.findChapters(asin, region)
if (!chapterData) {
return res.json({ error: 'Chapters not found' })
return res.json({ error: 'Chapters not found', stringKey: 'MessageChaptersNotFound' })
}
res.json(chapterData)
}