Quick fix to prevent undefined status code being set on response

I think the overall logic of our error handling might need some tweaks, but this fixes the immediate problem.

This closes #299