fixed error reading
This commit is contained in:
parent
01866b6a32
commit
9a8de527a1
|
@ -10,6 +10,7 @@ import java.util.Scanner;
|
|||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import de.mrbesen.telegram.commands.JSONCommandHandler;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -126,8 +127,8 @@ public class TelegramAPI implements Runnable {
|
|||
} else {
|
||||
String errdesc = "[No description available]";
|
||||
try {
|
||||
//try to read anyway to get error message
|
||||
JSONObject returned = new JSONObject(readfromIS(con.getInputStream()));
|
||||
//try to read error message
|
||||
JSONObject returned = new JSONObject(readfromIS(con.getErrorStream()));
|
||||
errdesc = returned.getString("description");
|
||||
} catch(Throwable ignore) { }
|
||||
throw new APIError(parameter, request, con.getResponseCode(), null, errdesc);
|
||||
|
|
Loading…
Reference in New Issue