title: Returning Error at Java Web Services
body: <p>I have a class like that:</p>
  
  <pre><code>@Override
  public StudentDTO getStudent(@WebParam(name = "name") String studentName) {
      StudentDTO student = new StudentDTO();
      try {
          student = studentService.findStudentByName(studentName);
      } catch (Exception e) {
          return new ErrorActionResponse("student couldn't find by name");
      }
      return student;
  }
  </code></pre>
  
  <p>As usual this doesn't work because of return type is <em>StudentDTO</em> and I try to return another type of class: <em>ErrorActionResponse</em>. ErrorActionResponse is an error class that has detailed information about error.</p>
  
  <p>How can I design my web service architecture that can handle error situations? (At my REST architecture I write error information into response and send error to client side)</p>