title: Android not catch Jersey RESTful Exceptions
body: <p>I have an Android application that consumes RESTful services using AndroidAnnotations and Spring Rest Template.</p>
  
  <p><strong>The services are being consumed properly, but when the RESTful service throws an unhandled exception the Android application stops running and is closed, even with the try catch encompassing service consumption.</strong></p>
  
  <p><em><strong>android-app:</em></strong></p>
  
  <pre><code>@RestService
  protected StudentRESTfulClient mStudentRESTfulClient;
  
  @Click(R.id.register_button)
  public void register(Student user) {
      try {
          this.mStudentRESTfulClient.insert(user);
      } catch (Exception exception) {
          // This block is not executed...
      }
  }
  </code></pre>
  
  <p><em><strong>restful-app:</em></strong></p>
  
  <pre><code>@POST
  public Student insert(Student entity) {
      this.getService().insert(entity); // Throw the exception here!
      return entity;
  }
  </code></pre>
  
  <p><strong>I know that the exception is not being treated in RESTful service, but I want my Android application can catch this type of problem and display a friendly message to the user.
  But the following error occurs even with the try catch:</strong></p>
  
  <pre><code>01-11 00:44:59.046: E/AndroidRuntime(5291): FATAL EXCEPTION: pool-1-thread-2
  01-11 00:44:59.046: E/AndroidRuntime(5291): org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error
  01-11 00:44:59.046: E/AndroidRuntime(5291): at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
  01-11 00:44:59.046: E/AndroidRuntime(5291): at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:524)
  </code></pre>
  
  <p>Git repository if they want to look at the whole project: <a href="https://github.com/veniltonjr/msplearning" rel="nofollow">https://github.com/veniltonjr/msplearning</a></p>
  
  <p>Already, thanks!</p>