code: public void reportServiceException(UniformInterfaceException ex,
      boolean showNotification)
    {
      QueryPanel qp = searchView.getControlPanel().getQueryPanel();
  
      String caption = null;
      String description = null;
  
      if(!AnnisBaseUI.handleCommonError(ex, "execute query"))
      {
        switch (ex.getResponse().getStatus())
        {
          case 400:
            List<AqlParseError> errors
              = ex.getResponse().getEntity(
                new GenericType<List<AqlParseError>>()
                {
                });
            caption = "Parsing error";
            description = Joiner.on("\n").join(errors);
            qp.setStatus(description);
            qp.setErrors(errors);
            break;
          case 504:
            caption = "Timeout";
            description = "Query execution took too long.";
            qp.setStatus(caption + ": " + description);
            break;
          case 403:
            if(Helper.getUser() == null)
            {
              // not logged in
              qp.setStatus("You don't have the access rights to query this corpus. "
                + "You might want to login to access more corpora.");
              searchView.getMainToolbar().showLoginWindow(true);
            }
            else
            {
              // logged in but wrong user
              caption = "You don't have the access rights to query this corpus. "
                + "You might want to login as another user to access more corpora.";
              qp.setStatus(caption);
            } break;
          default:
            log.error(
              "Exception when communicating with service", ex);
            qp.setStatus("Unexpected exception:  " + ex.getMessage());
            ExceptionDialog.show(ex,
              "Exception when communicating with service.");
            break;
        }
  
        if (showNotification && caption != null)
        {
          Notification.show(caption, description, Notification.Type.WARNING_MESSAGE);
        }
      }
  
    }
docs: Show errors that occured during the execution of a query to the user.
  
  @param ex The exception to report in the user interface
  @param showNotification If true a notification is shown instead of only
  displaying the error in the status label.