File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
spring-security-oauth/src/main Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11package org .baeldung .web ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
35import org .springframework .security .oauth2 .client .OAuth2RestTemplate ;
46import org .springframework .security .oauth2 .client .resource .UserApprovalRequiredException ;
57import org .springframework .security .oauth2 .client .resource .UserRedirectRequiredException ;
1214
1315@ Controller
1416public class RedditController {
15-
1617 private OAuth2RestTemplate redditRestTemplate ;
1718
19+ private final Logger LOGGER = LoggerFactory .getLogger (getClass ());
20+
1821 @ RequestMapping ("/info" )
1922 public String getInfo (Model model ) {
2023 try {
@@ -27,6 +30,7 @@ public String getInfo(Model model) {
2730 } catch (UserRedirectRequiredException e ) {
2831 throw e ;
2932 } catch (Exception e ) {
33+ LOGGER .error ("Error occurred" , e );
3034 model .addAttribute ("error" , e .getLocalizedMessage ());
3135 }
3236 return "reddit" ;
Original file line number Diff line number Diff line change 1010 <h1 >Your Reddit Info</h1 >
1111 <b >Your reddit username is </b >${ info }
1212 </c:when >
13- <c:otherwise > Sorry, error occurred.</c:otherwise >
13+ <c:otherwise >
14+ <b >Sorry, error occurred</b >
15+ <br ><br >
16+ <div >${ error } </div >
17+ </c:otherwise >
1418</c:choose >
1519</body >
1620</html >
You can’t perform that action at this time.
0 commit comments