Skip to content

Diana C.#14

Open
dianadenwik wants to merge 2 commits intoHackYourAssignment:mainfrom
dianadenwik:main
Open

Diana C.#14
dianadenwik wants to merge 2 commits intoHackYourAssignment:mainfrom
dianadenwik:main

Conversation

@dianadenwik
Copy link

No description provided.

@github-actions

This comment has been minimized.

@github-actions
Copy link

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

@sycons sycons self-assigned this Feb 21, 2026
Copy link

@sycons sycons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! ⭐
You did the assignment well and showed understanding of the concepts.

  • Setup & Configuration ✅
  • Data Structure ✅
  • Required Functions ✅
  • Error Handling ✅
  • Display (Chalk) ✅

import chalk from 'chalk'

const dataDir = '.'
const BOOKS = path.join(dataDir, 'books.json')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more helpful name would be booksPath. Currently with this name it looks like this variable holds the array of books. This can be a little misleading.

const data = fs.readFileSync(BOOKS, 'utf-8')
return JSON.parse(data)
} catch (error) {
if (error.code === 'ENOENT') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job handling errors based on the type of error ⭐

console.log('Invalid JSON in books.json. Starting with empty list.')
return []
}
throw error
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For unhandled errors, it is better to log it and then return an empty error, than to just throw the error.

console.log('📚 MY READING LIST 📚\n');
// 4. 4. Add example of filtering by genre or read/unread status
console.log(chalk.bold('\n📖 Unread Books:'));
const unread = getUnreadBooks();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done using the other functions and seeing them in action ⭐

@sycons sycons added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed To review labels Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants