mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 17:11:39 +03:00
[FIX] Вывод сообщения об ошибке в jsonRequest
This commit is contained in:
parent
4ab3c3a9f4
commit
bb04ed849c
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -61,6 +62,10 @@ public static JsonElement jsonRequest(JsonElement request, URL url) throws IOExc
|
|||
try {
|
||||
return parser.parse(reader);
|
||||
} catch (Exception e) {
|
||||
if(200 > statusCode || statusCode > 300) {
|
||||
LogHelper.error("JsonRequest failed. Server response code %d", statusCode);
|
||||
throw new IOException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue