Ensure correct error responses are returned when known exceptions occur

Fixes #5 
Fixes #4