aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-api/src/main/java/com/juick/api/TopManager.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TopManager.java b/juick-api/src/main/java/com/juick/api/TopManager.java
index b7734a1b..b8123639 100644
--- a/juick-api/src/main/java/com/juick/api/TopManager.java
+++ b/juick-api/src/main/java/com/juick/api/TopManager.java
@@ -23,8 +23,10 @@ import com.juick.util.MessageUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import javax.inject.Inject;
@@ -43,7 +45,13 @@ public class TopManager {
messagesService.setMessagePopular(m, 1);
Message jmsg = messagesService.getMessage(m);
String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText());
- facebookPageManager.post(status, "https://juick.com/" + jmsg.getMid());
+ try {
+ facebookPageManager.post(status, "https://juick.com/" + jmsg.getMid());
+ } catch (HttpClientErrorException ex) {
+ HttpStatus statusCode = ex.getStatusCode();
+ String responseString = ex.getResponseBodyAsString();
+ logger.warn("facebook error {}: {}", statusCode.value(), responseString);
+ }
});
}
}