diff options
author | Vitaly Takmazov | 2018-01-18 19:26:52 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-01-18 19:26:52 +0300 |
commit | 1d25d3f1f2b2aa117b78d395226efd2cb9ea39ac (patch) | |
tree | aabadadb3b68b6f6af6b753b331c1da3bc16426a /juick-api/src/main/java/com/juick/api | |
parent | 17c97aebd6e726eb574384576e9864b97810b22b (diff) |
api: log fb post errors
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TopManager.java | 10 |
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); + } }); } } |