Skip to content

Commit 43bb588

Browse files
committed
Make Azure messages at deployment a lot more readable
1 parent a302cba commit 43bb588

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsDeployCommand.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.microsoft.azure.toolkit.lib.auth.AzureCloud;
4242
import com.microsoft.azure.toolkit.lib.auth.AzureEnvironmentUtils;
4343
import com.microsoft.azure.toolkit.lib.common.bundle.AzureString;
44+
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException;
4445
import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager;
4546
import com.microsoft.azure.toolkit.lib.common.messager.IAzureMessage;
4647
import com.microsoft.azure.toolkit.lib.common.messager.IAzureMessager;
@@ -109,12 +110,16 @@ public void deploy(DeployConfig deployConfig, AzureFunctionsConfig config,
109110
Azure.az().config().setLogLevel(HttpLogDetailLevel.NONE.name());
110111
initAzureAppServiceClient(config);
111112

112-
final FunctionAppBase<?, ?, ?> target = createOrUpdateResource(
113-
config.toFunctionAppConfig(subscriptionId, appName.getAppName()));
114-
Path outputDirectory = output.getOutputDirectory();
115-
Path functionStagingDir = outputDirectory.resolve(AZURE_FUNCTIONS).resolve(appName.getAppName());
116-
117-
deployArtifact(functionStagingDir, target);
113+
try {
114+
final FunctionAppBase<?, ?, ?> target = createOrUpdateResource(
115+
config.toFunctionAppConfig(subscriptionId, appName.getAppName()));
116+
Path outputDirectory = output.getOutputDirectory();
117+
Path functionStagingDir = outputDirectory.resolve(AZURE_FUNCTIONS).resolve(appName.getAppName());
118+
119+
deployArtifact(functionStagingDir, target);
120+
} catch (AzureToolkitRuntimeException e) {
121+
throw new DeploymentException("Unable to deploy Azure function: " + e.getMessage().replace("\\r\\n", "\n"), e);
122+
}
118123
producer.produce(new DeployCommandActionBuildItem(AZURE_FUNCTIONS, true));
119124
}
120125

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package io.quarkus.azure.functions.deployment;
2+
3+
public class DeploymentException extends RuntimeException {
4+
5+
public DeploymentException(String message, Throwable cause) {
6+
super(message, cause);
7+
}
8+
}

0 commit comments

Comments
 (0)