hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/KeySpaceManagerProtocolServerSideTranslatorPB.java
private Status exceptionToResponseStatus(IOException ex) {
    if (ex instanceof KSMException) {
      KSMException ksmException = (KSMException)ex;
      switch (ksmException.getResult()) {
      case FAILED_VOLUME_ALREADY_EXISTS:
        return Status.VOLUME_ALREADY_EXISTS;
      case FAILED_TOO_MANY_USER_VOLUMES:
        return Status.USER_TOO_MANY_VOLUMES;
      case FAILED_VOLUME_NOT_FOUND:
        return Status.VOLUME_NOT_FOUND;
      case FAILED_VOLUME_NOT_EMPTY:
        return Status.VOLUME_NOT_EMPTY;
      case FAILED_USER_NOT_FOUND:
        return Status.USER_NOT_FOUND;
      case FAILED_BUCKET_ALREADY_EXISTS:
        return Status.BUCKET_ALREADY_EXISTS;
      case FAILED_BUCKET_NOT_FOUND:
        return Status.BUCKET_NOT_FOUND;
      case FAILED_BUCKET_NOT_EMPTY:
        return Status.BUCKET_NOT_EMPTY;
      case FAILED_KEY_ALREADY_EXISTS:
        return Status.KEY_ALREADY_EXISTS;
      case FAILED_KEY_NOT_FOUND:
        return Status.KEY_NOT_FOUND;
      default:
        return Status.INTERNAL_ERROR;
      }
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Unknown error occurs", ex);
      }
      return Status.INTERNAL_ERROR;
    }
  }
// Convert and exception to corresponding status code
Convert and exception to corresponding status code
Convert and exception to corresponding status code
private Status exceptionToResponseStatus(IOException ex) {
    if (ex instanceof KSMException) {
      KSMException ksmException = (KSMException)ex;
      switch (ksmException.getResult()) {
      case FAILED_VOLUME_ALREADY_EXISTS:
        return Status.VOLUME_ALREADY_EXISTS;
      case FAILED_TOO_MANY_USER_VOLUMES:
        return Status.USER_TOO_MANY_VOLUMES;
      case FAILED_VOLUME_NOT_FOUND:
        return Status.VOLUME_NOT_FOUND;
      case FAILED_VOLUME_NOT_EMPTY:
        return Status.VOLUME_NOT_EMPTY;
      case FAILED_USER_NOT_FOUND:
        return Status.USER_NOT_FOUND;
      case FAILED_BUCKET_ALREADY_EXISTS:
        return Status.BUCKET_ALREADY_EXISTS;
      case FAILED_BUCKET_NOT_FOUND:
        return Status.BUCKET_NOT_FOUND;
      case FAILED_BUCKET_NOT_EMPTY:
        return Status.BUCKET_NOT_EMPTY;
      case FAILED_KEY_ALREADY_EXISTS:
        return Status.KEY_ALREADY_EXISTS;
      case FAILED_KEY_NOT_FOUND:
        return Status.KEY_NOT_FOUND;
      default:
        return Status.INTERNAL_ERROR;
      }
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Unknown error occurs", ex);
      }
      return Status.INTERNAL_ERROR;
    }
  }
private Status exceptionToResponseStatus ( IOException ex ) { if ( ex instanceof KSMException ) { KSMException ksmException = ( KSMException ) ex ; switch ( ksmException . getResult ( ) ) { case FAILED_VOLUME_ALREADY_EXISTS : return Status . VOLUME_ALREADY_EXISTS ; case FAILED_TOO_MANY_USER_VOLUMES : return Status . USER_TOO_MANY_VOLUMES ; case FAILED_VOLUME_NOT_FOUND : return Status . VOLUME_NOT_FOUND ; case FAILED_VOLUME_NOT_EMPTY : return Status . VOLUME_NOT_EMPTY ; case FAILED_USER_NOT_FOUND : return Status . USER_NOT_FOUND ; case FAILED_BUCKET_ALREADY_EXISTS : return Status . BUCKET_ALREADY_EXISTS ; case FAILED_BUCKET_NOT_FOUND : return Status . BUCKET_NOT_FOUND ; case FAILED_BUCKET_NOT_EMPTY : return Status . BUCKET_NOT_EMPTY ; case FAILED_KEY_ALREADY_EXISTS : return Status . KEY_ALREADY_EXISTS ; case FAILED_KEY_NOT_FOUND : return Status . KEY_NOT_FOUND ; default : return Status . INTERNAL_ERROR ; } } else { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Unknown error occurs" , ex ) ; } return Status . INTERNAL_ERROR ; } }
Convert and exception to corresponding status code
Convert and exception to corresponding status code