Return 'Bad Request' error code if validation fails

Fixes #233