Error handle
This commit is contained in:
@@ -50,6 +50,12 @@ public class Main {
|
||||
.build();
|
||||
|
||||
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
|
||||
if (response.statusCode() == 401) {
|
||||
System.err.println("Invalid credentials ! Pleas try again (defaults credentials could help)");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
JSONObject responseObject = new JSONObject(response.body());
|
||||
String token = responseObject.optString("token");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user