Handling Rejections
Rejection
π¨βπΌ Our API sometimes fails, and we need to handle those failures gracefully.
Rejected Promises should be caught so we can return a friendly error state.
π¨ Open
and:
- Update
getUserProfileto handle rejections with.catch() - Return an error result when the Promise rejects
- Keep the
idparameter flowing through both functions - Export
fetchUserandgetUserProfile
π° For the error result, return a
{ status: 'error', message: string } object.
If the value isn't an Error, use 'Unknown error' as the message.

