Handle exceptions better to the API user. One can no specify the API error code when any excetion is raised. See ActionError in core for an example.