Do like started on movieInfo and showInfo. There we check the status codes right after our requests to themoviedb api.
Improvements:
Check if the error is a http error.
Create error response dictonary to throw http status code and error message from.
Type safety
Example:
.catch(error => {
if (error.status === 401) {
throw new Error('Unathorized tmdb request, please check api key.')
} else if (error.status === 404) {
throw new Error(`Could not find a movie with id: ${identifier}`)
}
throw new Error('Unexpected error has occured:', error.message)
})
Do like started on
movieInfo
andshowInfo
. There we check the status codes right after our requests to themoviedb api.Improvements:
Example: