title: What is the difference between UnauthorizedException vs OAuthRequestException in Cloud Endpoints?
body: <p>In Cloud Endpoints, I understand that when doing OAuth I need to check if <code>user == null</code> to determine if a user has authenticated. In the case that the user is null I should throw an exception. In sample Google Cloud Endpoints code snippets I have seen two different exceptions being used though. </p>
  
  <p>The <a href="https://developers.google.com/appengine/docs/java/endpoints/auth" rel="nofollow">OAuth documentation for cloud endpoints</a> says to throw <code>OAuthRequestException</code>. However, I have seen other code bases (including a <a href="https://github.com/udacity/ud859/blob/master/Lesson_6/00_Conference_Central/src/main/java/com/google/devrel/training/conference/spi/ConferenceApi.java" rel="nofollow">Udacity Course</a>) throw <code>UnauthorizedException</code>.</p>
  
  <p>I've noticed that OAuthRequestException does not extends from com.google.api.server.spi.ServiceException so Im thinking UnauthorizedException is the correct choice?</p>
  
  <p>Which one should I use?</p>