Welcome to the Linux Foundation Forum!

Lab 5.1 validation

I am using express and I have trouble passing "GET http://localhost:56700/boat/be97 responded with 500 response"

After I looked into validate.js:

I personally think there should be a "return" after line 316. If not then Error('not found') will be thrown after Error('unknown') and response eventually has status code 404 instead of 500.

After I put in "return" on line 317 I can indeed pass the test.

Is My reasoning correct? Or I am doing something wrong?

Thanks

Comments

  • Maybe you can use "else" in line 318 and join that with the next if. the setImmediate are emulate an async operation, and you are evaluating other if without finish the setImmediate. at the end you can use an "else" to finish the last command.

    In other hand, remember that the error handler in app.js from express generator send the 500 error as a middleware on the server.

  • I managed to get it done. The answer is very close to the sample code in the lesson.

  • nicely debugged @zf12 I think that is a bug. Thanks for pointing that out, it's being fixed right now.

Categories

Upcoming Training