ensures an error is thrown on failure