static RuntimeException translateAthenaException()

in workgroup/src/main/java/software/amazon/athena/workgroup/HandlerUtils.java [38:52]


  static RuntimeException translateAthenaException(AthenaException e, String resourceIdentifier) {
    if (e instanceof InvalidRequestException) {
      if (e.getMessage() != null && e.getMessage().contains(WORKGROUP_NOT_FOUND)) {
        return new CfnNotFoundException(TYPE_NAME, resourceIdentifier, e);
      } else if (e.getMessage() != null && e.getMessage().contains(WORKGROUP_ALREADY_CREATED)) {
        return new CfnAlreadyExistsException(TYPE_NAME, resourceIdentifier, e);
      } else {
        return new CfnInvalidRequestException(e.getMessage(), e);
      }
    } else if (e instanceof InternalServerException) {
      return new CfnGeneralServiceException(e.getMessage(), e);
    }

    return e;
  }