Browse Source

less errbit reporting for common client errors

tags/v0.13.1
Jonathan Cobb 4 years ago
parent
commit
1f941f3d3d
4 changed files with 17 additions and 9 deletions
  1. +8
    -1
      bubble-server/src/main/java/bubble/client/BubbleNodeClient.java
  2. +1
    -1
      bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java
  3. +4
    -4
      bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java
  4. +4
    -3
      bubble-server/src/main/java/bubble/service/notify/NotificationService.java

+ 8
- 1
bubble-server/src/main/java/bubble/client/BubbleNodeClient.java View File

@@ -13,6 +13,7 @@ import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.cobbzilla.util.http.ApiConnectionInfo; import org.cobbzilla.util.http.ApiConnectionInfo;
import org.cobbzilla.util.http.HttpRequestBean; import org.cobbzilla.util.http.HttpRequestBean;
@@ -20,6 +21,8 @@ import org.cobbzilla.wizard.server.config.HttpConfiguration;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -102,8 +105,12 @@ public class BubbleNodeClient extends BubbleApiClient {
try { try {
log.debug("execute: attempting request..."); log.debug("execute: attempting request...");
return super.execute(client, request); return super.execute(client, request);

} catch (ConnectException | ConnectTimeoutException | UnknownHostException e) {
throw e;

} catch (Exception e) { } catch (Exception e) {
return die("execute("+request+"): error: "+e);
throw new IllegalStateException("execute("+request+"): error: "+e, e);
} }
} }




+ 1
- 1
bubble-server/src/main/java/bubble/service/cloud/NodeLauncher.java View File

@@ -33,7 +33,7 @@ public class NodeLauncher implements Runnable {
try { try {
for (int i=0; i<LAUNCH_MAX_RETRIES; i++) { for (int i=0; i<LAUNCH_MAX_RETRIES; i++) {
if (i > 0 && !launchMonitor.isRegistered(networkUuid)) { if (i > 0 && !launchMonitor.isRegistered(networkUuid)) {
die("NodeLauncher.run: no longer registered: "+networkUuid);
throw new IllegalStateException("NodeLauncher.run: no longer registered: "+networkUuid);
} }
if (!lock.get().equals(newNodeRequest.getLock())) { if (!lock.get().equals(newNodeRequest.getLock())) {
die("NodeLauncher.run: existingLock (" + lock.get() + ") is different than lock in NewNodeNotification: " + newNodeRequest.getLock()); die("NodeLauncher.run: existingLock (" + lock.get() + ") is different than lock in NewNodeNotification: " + newNodeRequest.getLock());


+ 4
- 4
bubble-server/src/main/java/bubble/service/notify/NotificationInboxProcessor.java View File

@@ -22,10 +22,10 @@ import static org.cobbzilla.util.json.JsonUtil.json;
@AllArgsConstructor @Slf4j @AllArgsConstructor @Slf4j
public class NotificationInboxProcessor implements Runnable { public class NotificationInboxProcessor implements Runnable {


private ReceivedNotification n;
private Map<String, SynchronousNotification> syncRequests;
private BubbleConfiguration configuration;
private ReceivedNotificationDAO receivedNotificationDAO;
private final ReceivedNotification n;
private final Map<String, SynchronousNotification> syncRequests;
private final BubbleConfiguration configuration;
private final ReceivedNotificationDAO receivedNotificationDAO;


@Override public void run() { @Override public void run() {
try { try {


+ 4
- 3
bubble-server/src/main/java/bubble/service/notify/NotificationService.java View File

@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.net.ConnectException; import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;


@@ -122,17 +123,17 @@ public class NotificationService {
log.debug("_notify: <<<<< RECEIPT <<<<<< " + json(receipt, COMPACT_MAPPER) + " <<<<<<<<<<<<<<<<<<"); log.debug("_notify: <<<<< RECEIPT <<<<<< " + json(receipt, COMPACT_MAPPER) + " <<<<<<<<<<<<<<<<<<");
return receipt; return receipt;


} catch (ConnectException | ConnectTimeoutException | ApiException e) {
} catch (ConnectException | ConnectTimeoutException | UnknownHostException | ApiException e) {
notification.setStatus(NotificationSendStatus.error); notification.setStatus(NotificationSendStatus.error);
notification.setException(e); notification.setException(e);
sentNotificationDAO.update(notification); sentNotificationDAO.update(notification);
return die("_notify: " + e);
throw new IllegalStateException("_notify: "+shortError(e), e);


} catch (Exception e) { } catch (Exception e) {
notification.setStatus(NotificationSendStatus.error); notification.setStatus(NotificationSendStatus.error);
notification.setException(e); notification.setException(e);
sentNotificationDAO.update(notification); sentNotificationDAO.update(notification);
return die("_notify: " + e, e);
return die("_notify: "+shortError(e), e);
} }
} }
} }


Loading…
Cancel
Save