Structured Errors for API

This closes issue #23 by implementing structured errors in API calls. The API now returns more helpful information in the error page when it encounters an error.
This should have a return statement.