eugenp/tutorials

[ISSUE] Wrong example code in https://www.baeldung.com/spring-boot-restclient

lwy1471 opened this issue · 1 comments

Article and Module Links
https://www.baeldung.com/spring-boot-restclient

Describe the Issue

Article article = restClient.get()
  .uri(uriBase + "/articles/1234")
  .retrieve()
  .onStatus(status -> status.value() == 404, (request, response) -> {
      throw new ArticleNotFoundException(response)
  })
  .body(Article.class);

The provided code snippet is missing a semicolon (;) at the end of the throw new ArticleNotFoundException(response) line.

Expected Behavior

Article article = restClient.get()
  .uri(uriBase + "/articles/1234")
  .retrieve()
  .onStatus(status -> status.value() == 404, (request, response) -> {
      throw new ArticleNotFoundException(response);
  })
  .body(Article.class);

Hey, @lwy1471.

Thanks for the feedback. We've updated the article to fix this.