Skip to content

Assignment2#2

Open
SohailJannessari wants to merge 2 commits intoTechLabs-Dusseldorf:mainfrom
SohailJannessari:main
Open

Assignment2#2
SohailJannessari wants to merge 2 commits intoTechLabs-Dusseldorf:mainfrom
SohailJannessari:main

Conversation

@SohailJannessari
Copy link

No description provided.

@Rumas97
Copy link

Rumas97 commented Dec 23, 2025

Good job! Does exactly what it's supposed to do and human friendly error messages. Super 😁

`Oops! ${response.status} (${response.statusText})`
);
}
const data = await response.json();
Copy link
Contributor

Choose a reason for hiding this comment

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

check for unexpected data formats, here we expect strings

Suggested change
const data = await response.json();
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 this level of validation or defensive programming is not necessary for learning goals at this point

@ibhf13
Copy link
Contributor

ibhf13 commented Dec 29, 2025

great job 💪

@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