diff --git a/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java index 90e6cb0..3ffbb58 100644 --- a/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java +++ b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java @@ -122,6 +122,7 @@ System.out.println("response null : setViewModel"); } } else { + errorLiveData.setValue(parseStatusCode(response.code())); System.out.println("ステータスコード 不正 : setViewModel"); } } @@ -131,6 +132,7 @@ public void onFailure(Call> call, Throwable t) { System.out.println("通信失敗 : setViewModel"); System.out.println(t); + errorLiveData.setValue(ErrorType.UnknownError.getText()); } }); } @@ -148,6 +150,7 @@ nearShopsLiveData.setValue(response.body()); } else { System.out.println("ShopsViewModel : 通信失敗"); + errorLiveData.setValue(parseStatusCode(response.code())); } } @@ -156,6 +159,7 @@ public void onFailure(Call> call, Throwable t) { System.out.println("setViewModel : 通信失敗"); System.out.println(t); + errorLiveData.setValue(ErrorType.UnknownError.getText()); } }); } @@ -169,6 +173,8 @@ public void onResponse(Call call, Response response) { if (response.isSuccessful()) { currentShopLiveData.setValue(response.body()); + } else { + errorLiveData.setValue(parseStatusCode(response.code())); } } @@ -176,6 +182,7 @@ public void onFailure(Call call, Throwable t) { System.out.println("通信失敗 : createShop"); System.out.println(t); + errorLiveData.setValue(ErrorType.UnknownError.getText()); } }); }