public Class<? extends WebDriverException> getExceptionType(int statusCode) {
    if (SUCCESS == statusCode) {
      return null;
    }

    // We know that the tuple of (status code, exception) is distinct.
    Set<Class<? extends WebDriverException>> allPossibleExceptions = KNOWN_ERRORS.stream()
      .filter(knownError -> knownError.getJsonCode() == statusCode)
      .map(KnownError::getException)
      .collect(Collectors.toSet());

    return Iterables.getOnlyElement(allPossibleExceptions, WebDriverException.class);
  }
public Class < ? extends WebDriverException > getExceptionType ( int statusCode ) { if ( SUCCESS == statusCode ) { return null ; } Set < Class < ? extends WebDriverException > > allPossibleExceptions = KNOWN_ERRORS . stream ( ) . filter ( knownError -> knownError . getJsonCode ( ) == statusCode ) . map ( KnownError :: getException ) . collect ( Collectors . toSet ( ) ) ; return Iterables . getOnlyElement ( allPossibleExceptions , WebDriverException . class ) ; }
Returns the exception type that corresponds to the given {@code statusCode}. All unrecognized
status codes will be mapped to {@link WebDriverException WebDriverException.class}.

@param statusCode The status code to convert.
@return The exception type that corresponds to the provided status code or {@code null} if
{@code statusCode == 0}.