---
title: "Discussion on \"Spring RestTemplate treats Non-200 status as Exception\" | Hashnode"
description: "Discussion on \"Spring RestTemplate treats Non-200 status as Exception\". Recently I run into the following code snippets:\nResponseEntity<ApmTopoResponse> response2 = null;\ntry {\n  response2 = restTemplate.exchange(topoUrl, HttpMethod.GET, request, ApmTopoResponse.class, 1);\n} catch (Exception e) {\n  throw new CustomExcept..."
url: "https://hashnode.com/posts/spring-resttemplate-treats-non-200-status-as-exception/5f8fe50df5dd254fbf5fb184"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Spring RestTemplate treats Non-200 status as Exception](https://kenhu.hashnode.dev/spring-resttemplate-treats-non-200-status-as-exception?utm_source=hashnode&utm_medium=feed)

Recently I run into the following code snippets: ResponseEntity<ApmTopoResponse> response2 = null; try { response2 = restTemplate.exchange(topoUrl, HttpMethod.GET, request, ApmTopoResponse.class, 1); } catch (Exception e) { throw new CustomExcept...

Oct 21, 2020 · 4 min read · kenhu.hashnode.dev  
Read the article

-   [#spring](https://hashnode.com/tag/spring)
-   [#java](https://hashnode.com/tag/java)

## Written by

[Ken Hu](https://hashnode.com/@kenhu)

@kenhu · Kaohsiung, Taiwan

  
[View profile](https://hashnode.com/@kenhu)

Software Developer and Product Manager

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
