File tree 1 file changed +8
-0
lines changed
samples/messages-client/src/main/java/sample/web
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 25
25
import org .springframework .stereotype .Controller ;
26
26
import org .springframework .ui .Model ;
27
27
import org .springframework .util .StringUtils ;
28
+ import org .springframework .web .bind .annotation .ExceptionHandler ;
28
29
import org .springframework .web .bind .annotation .GetMapping ;
29
30
import org .springframework .web .reactive .function .client .WebClient ;
31
+ import org .springframework .web .reactive .function .client .WebClientResponseException ;
30
32
31
33
import static org .springframework .security .oauth2 .client .web .reactive .function .client .ServletOAuth2AuthorizedClientExchangeFilterFunction .clientRegistrationId ;
32
34
import static org .springframework .security .oauth2 .client .web .reactive .function .client .ServletOAuth2AuthorizedClientExchangeFilterFunction .oauth2AuthorizedClient ;
@@ -99,4 +101,10 @@ public String deviceCodeGrant() {
99
101
return "device-activate" ;
100
102
}
101
103
104
+ @ ExceptionHandler (WebClientResponseException .class )
105
+ public String handleError (Model model , WebClientResponseException ex ) {
106
+ model .addAttribute ("error" , ex .getMessage ());
107
+ return "index" ;
108
+ }
109
+
102
110
}
You can’t perform that action at this time.
0 commit comments