Switch to exception based error handling.

Because we want to bail at any time without having to write the code in a way
that has to accommodate always returning a proper response, I added a RESTError
exception that gets raised when we want to cleanly returns the error without
any unneeded code.