@Override
  public Type classify(final Throwable e) {
    final Type type =
        e instanceof AuthorizationException
        || e instanceof StreamsException
            && e.getCause() instanceof AuthorizationException
        ? Type.USER
        : Type.UNKNOWN;

    if (type == Type.USER) {
      LOG.info(
          "Classified error as USER error based on missing access rights."
              + " Query ID: {} Exception: {}",
          queryId,
          e);
    }

    return type;
  }
@Test
  public void shouldClassifyWrappedAuthorizationExceptionAsUserError() {
    // Given:
    final Exception e = new StreamsException(new AuthorizationException("foo"));

    // When:
    final Type type = new AuthorizationClassifier("").classify(e);

    // Then:
    assertThat(type, is(Type.USER));
  }