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.
We should have a default coded error for this.