|
|
@ -115,17 +115,8 @@ public class OpenAI {
|
|
|
|
String error = "Error " + status + ": " + connection.getResponseMessage();
|
|
|
|
String error = "Error " + status + ": " + connection.getResponseMessage();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
InputStream is = connection.getErrorStream();
|
|
|
|
InputStream is = connection.getErrorStream();
|
|
|
|
if (is != null) {
|
|
|
|
if (is != null)
|
|
|
|
json = Helper.readStream(is);
|
|
|
|
error += "\n" + Helper.readStream(is);
|
|
|
|
Log.w(json);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
JSONObject jresponse = new JSONObject(json);
|
|
|
|
|
|
|
|
JSONObject jerror = jresponse.getJSONObject("error");
|
|
|
|
|
|
|
|
error += "\n" + jerror.getString("type") + ": " + jerror.getString("message");
|
|
|
|
|
|
|
|
} catch (JSONException e) {
|
|
|
|
|
|
|
|
error += "\n" + json;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|