Test api exception