static Exception distinguishNotFound(final String message) { Pattern p = Pattern.compile("The messaging entity .* could not be found"); Matcher m = p.matcher(message); if (m.find()) { return new IllegalEntityException(message); } else { return new EventHubException(true, String.format(ClientConstants.AMQP_REQUEST_FAILED_ERROR, AmqpResponseCode.NOT_FOUND, message)); } }
notifyWith = e.getCause(); throw new CompletionException(new IllegalEntityException("Failure getting partition ids for event hub", notifyWith)); } catch (EventHubException | IOException e) { retval = new CompletableFuture<Void>(); retval.completeExceptionally(new IllegalEntityException("Failure getting partition ids for event hub", e));
return ExceptionUtil.distinguishNotFound(errorCondition.getDescription()); } else if (errorCondition.getCondition() == ClientConstants.ENTITY_DISABLED_ERROR) { return new IllegalEntityException(errorCondition.getDescription()); } else if (errorCondition.getCondition() == AmqpErrorCode.Stolen) { return new ReceiverDisconnectedException(errorCondition.getDescription());