fixed apiexception handling to get error code/reject flow