当试图连接一个不存在的直播间时抛出 IllegalArgumentException

This commit is contained in:
czp 2018-02-23 01:05:17 +08:00
parent 08c8b52fa1
commit 5f2f753b0f
2 changed files with 10 additions and 1 deletions

View File

@ -183,4 +183,7 @@ public interface LiveService {
//佩戴头衔
@GET("AppUser/wearTitle")
Call<WearTitleResponseEntity> wearTitle(@Query("title") String title);
//侧拉抽屉 -> 直播中心 -> 瓜子商店 -> 银瓜子兑换 -> 硬币银瓜子互换 -> 兑换硬币
// 700 银瓜子兑换为 1 硬币, 每个用户每天只能换一次
}

View File

@ -59,12 +59,18 @@ public class LiveClient implements Closeable {
initEventBus();
}
@Nonnull
public LiveRoomInfoEntity.LiveRoomEntity fetchRoomInfo() throws IOException {
return bilibiliServiceProvider.getLiveService()
LiveRoomInfoEntity.LiveRoomEntity liveRoomEntity = bilibiliServiceProvider.getLiveService()
.getRoomInfo(showRoomId)
.execute()
.body()
.getData();
if (liveRoomEntity != null) {
return liveRoomEntity;
} else {
throw new IllegalArgumentException("Target room " + showRoomId + " not exists");
}
}
public synchronized LiveClient connect() throws IOException {