Learn

Code Challenge

Instructions

1.

The server will handle requests for existing food indices as expected, but it will call next with an error in response to a request for a non-existent food.

Complete the errorHandler function as an Express error handling function. It should set the response status equal to the error object’s status property if it exists, and 500 by default if there is no status on the error object. It should send the message property of the error object as its response.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?