test for raising API errors correctly