add error_handler reporting errors via email
throw API errors, fixes #47