Skip to content

completed funny bones backend assignment#5

Open
AbdallahOdeh2006 wants to merge 1 commit intoTechLabs-Dusseldorf:mainfrom
AbdallahOdeh2006:main
Open

completed funny bones backend assignment#5
AbdallahOdeh2006 wants to merge 1 commit intoTechLabs-Dusseldorf:mainfrom
AbdallahOdeh2006:main

Conversation

@AbdallahOdeh2006
Copy link

No description provided.

@AbdallahOdeh2006
Copy link
Author

Assignment completed! Ready for review.

@ibhf13
Copy link
Contributor

ibhf13 commented Dec 29, 2025

great job 💪

Comment on lines +15 to +17
if (!joke.setup || !joke.punchline) {
throw new Error('Invalid joke data');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure strings, not just “truthy”

Suggested change
if (!joke.setup || !joke.punchline) {
throw new Error('Invalid joke data');
}
if (typeof data?.setup !== "string" || typeof data?.punchline !== "string") {
throw new Error("Unexpected data format from API");
}

Copy link

Choose a reason for hiding this comment

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

fair point, but the data format refers to the structure and the expected fields of the response and not type validation :) So for this level of learning, not necessary I'd say

@ibhf13 ibhf13 added the checked PR checked label Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

checked PR checked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants